Image coding method on basis of secondary transform and device therefor

ABSTRACT

An image information decoding method performed by means of a decoding device according to the present invention comprises the steps of: decoding a non-separable secondary transform (NSST) index from a bitstream if NSST is applied to a target block; decoding information relating to transform coefficients with respect to the target block from the bitstream on the basis of the decoded NSST index; and deriving the transform coefficients with respect to the target block on the basis of the decoded information relating to the transform coefficients, wherein the NSST index is decoded prior to the information relating to the transform coefficients with respect to the target block.

CROSS-REFERENCE TO RELATED APPLICATIONS

Pursuant to 35 U.S.C. § 119(e), this application is a ContinuationApplication of U.S. patent application Ser. No. 16/954,026, filed Jun.15, 2020, which is a National Stage filing under 35 U.S.C. 371 ofInternational Application PCT/KR2018/015809, filed Dec. 13, 2018 whichclaims the benefit of U.S. Provisional Patent Application No.62/599,022, filed on Dec. 15, 2017, the contents of which are herebyincorporated by reference herein in its entirety.

Background of the Disclosure Field of the Disclosure

The present disclosure relates to an image coding technology, and moreparticularly, to an image coding method and apparatus based on secondarytransform in an image coding system.

Related Art

Demands for high-resolution and high-quality images, such as HD (HighDefinition) images and UHD (Ultra High Definition) images, areincreasing in various fields. As image data has high resolution and highquality, the amount of information or bits to be transmitted increasesrelative to legacy image data. Accordingly, when image data istransmitted using a medium, such as a conventional wired/wirelessbroadband line, or image data is stored using an existing storagemedium, a transmission cost and a storage cost thereof are increased.

Accordingly, there is a need for a highly efficient image compressiontechnique for effectively transmitting, storing, and reproducinginformation of high resolution and high quality images.

SUMMARY

An object of the present disclosure is to provide a method and anapparatus for enhancing image coding efficiency.

Another object of the present disclosure is to provide a method and anapparatus for enhancing transform efficiency.

Still another object of the present disclosure is to provide a methodand an apparatus for enhancing efficiency of a residual coding throughtransform.

Yet another object of the present disclosure is to provide an imagecoding method and apparatus based on secondary transform.

Still yet another object of the present disclosure is to provide amethod and an apparatus for enhancing image coding efficiency based on asecondary transform index.

An exemplary embodiment of the present disclosure provides an imageinformation decoding method performed by a decoding apparatus. Themethod includes: decoding a non-separable secondary transform (NSST)index from a bitstream, if an NSST is applied to a target block,decoding information about transform coefficients for the target blockfrom the bitstream, based on the decoded NSST index, and deriving thetransform coefficients for the target block based on the decodedinformation about the transform coefficients, in which the NSST index isdecoded prior to the information about the transform coefficients forthe target block.

Another exemplary embodiment of the present disclosure provides an imageinformation encoding method performed by an encoding apparatus. Themethod includes: generating and encoding a non-separable secondarytransform (NSST) index, if an NSST is applied to a target block,transforming coefficients for the target block, and generating andencoding information about transform coefficients for the target block,based on the NSST index, in which the NSST index is encoded prior to theinformation about the transform coefficients for the target block.

Still another exemplary embodiment of the present disclosure provides adecoding apparatus for decoding image information. The decodingapparatus includes: an entropy decoder which decodes a non-separablesecondary transform (NSST) index from a bitstream, if an NSST is appliedto a target block, decodes information about transform coefficients forthe target block from the bitstream, based on the decoded NSST index,and derives the transform coefficients for the target block based on thedecoded information about the transform coefficients and an inversetransformer which inversely transforms the derived transformcoefficients for the target block, based on the decoded NSST index, inwhich the NSST index is decoded prior to the information about thetransform coefficients for the target block.

Yet another exemplary embodiment of the present disclosure provides anencoding apparatus for encoding image information. The encodingapparatus includes: an entropy encoder which generates and encodes anon-separable secondary transform (NSST) index, if an NSST is applied toa target block, and generates and encodes information about transformcoefficients for the target block based on the NSST index and atransformer which transforms coefficients for the target block, in whichthe NSST index is encoded prior to the information about the transformcoefficients for the target block.

According to the present disclosure, it is possible to enhance theoverall image/video compression efficiency.

According to the present disclosure, it is possible to decrease theamount of data to be transmitted for the residual processing through theefficient transform, and to enhance the residual coding efficiency.

According to the present disclosure, it is possible to concentrate thenon-zero transform coefficients on the low frequency component throughthe secondary transform in the frequency domain.

According to the present disclosure, it is possible to perform the imagecoding based on the secondary transform index, thereby enhancing theimage coding efficiency.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a schematic diagram illustrating a configuration of avideo/image encoding apparatus to which the present disclosure isapplicable.

FIG. 2 is a schematic diagram illustrating a configuration of avideo/image decoding apparatus to which the present disclosure isapplicable.

FIG. 3 is a schematic diagram illustrating a multiple transformtechnique according to an exemplary embodiment.

FIGS. 4A and 4B are flowcharts illustrating a coding process oftransform coefficients according to an exemplary embodiment.

FIGS. 5A and 5B are flowcharts specifically illustrating the codingprocess of the transform coefficients according to an exemplaryembodiment.

FIGS. 6A and 6B are flowcharts illustrating the coding process of thetransform coefficients according to an exemplary embodiment of thepresent disclosure.

FIGS. 7A and 7B are flowcharts illustrating a coding process oftransform coefficients according to another exemplary embodiment of thepresent disclosure.

FIGS. 8A and 8B are flowcharts illustrating a coding process oftransform coefficients according to still another exemplary embodimentof the present disclosure.

FIG. 9 is a diagram illustrating the arrangement of transformcoefficients based on a target block according to an exemplaryembodiment of the present disclosure.

FIG. 10 is a flowchart illustrating an operation of a video encodingapparatus according to an exemplary embodiment of the presentdisclosure.

FIG. 11 is a flowchart illustrating an operation of a video decodingapparatus according to an exemplary embodiment of the presentdisclosure.

DESCRIPTION OF EXEMPLARY EMBODIMENTS

An exemplary embodiment of the present disclosure provides an imageinformation decoding method performed by a decoding apparatus. Themethod includes: decoding a non-separable secondary transform (NSST)index from a bitstream, if an NSST is applied to a target block,decoding information about transform coefficients for the target blockfrom the bitstream, based on the decoded NSST index, and deriving thetransform coefficients for the target block based on the decodedinformation about the transform coefficients, in which the NSST index isdecoded prior to the information about the transform coefficients forthe target block.

The present disclosure may be modified in various forms, and specificembodiments thereof will be described and illustrated in the drawings.However, the embodiments are not intended for limiting the disclosure.The terms used in the following description are used to merely describespecific embodiments, but are not intended to limit the disclosure. Anexpression of a singular number includes an expression of the pluralnumber, so long as it is clearly read differently. The terms such as“include” and “have” are intended to indicate that features, numbers,steps, operations, elements, components, or combinations thereof used inthe following description exist and it should be thus understood thatthe possibility of existence or addition of one or more differentfeatures, numbers, steps, operations, elements, components, orcombinations thereof is not excluded.

Meanwhile, elements in the drawings described in the disclosure areindependently drawn for the purpose of convenience for explanation ofdifferent specific functions, and do not mean that the elements areembodied by independent hardware or independent software. For example,two or more elements of the elements may be combined to form a singleelement, or one element may be divided into plural elements. Theembodiments in which the elements are combined and/or divided belong tothe disclosure without departing from the concept of the disclosure.

The following description may be applied in the technical field whichdeals with videos, images, or images. For example, a method or anexemplary embodiment disclosed in the following description may beassociated with the disclosed contents of a Versatile Video Coding (VVC)standard (ITU-T Rec. H.266), a next-generation video/image codingstandard after the VVC, or standards before the VVC (for example, a HighEfficiency Video Coding (HEVC) standard (ITU-T Rec. H.265) or the like).

Hereinafter, examples of the present embodiment will be described indetail with reference to the accompanying drawings. In addition, likereference numerals are used to indicate like elements throughout thedrawings, and the same descriptions on the like elements will beomitted.

In the present disclosure, a video may mean a set of a series of imagesaccording to a passage of time. Generally a picture means a unitrepresenting an image at a specific time, a slice is a unit constitutinga part of the picture. One picture may be composed of plural slices, andthe terms of a picture and a slice may be mixed with each other asoccasion demands.

A pixel or a pel may mean a minimum unit constituting one picture (orimage). In addition, a “sample” may be used as a term corresponding to apixel. The sample may generally represent a pixel or a value of a pixel,may represent only a pixel (a pixel value) of a luma component, and mayrepresent only a pixel (a pixel value) of a chroma component.

A unit indicates a basic unit of image processing. The unit may includeat least one of a specific area and information about the area.Optionally, the unit may be mixed with terms such as a block, an area,or the like. In a typical case, an M×N block may represent a set ofsamples or transform coefficients arranged in M columns and N rows.

FIG. 1 briefly illustrates a structure of a video/image encodingapparatus to which the present disclosure is applicable. Hereinafter, anencoding apparatus may include a video encoding apparatus and/or animage encoding apparatus, and the video encoding apparatus may be usedas a concept comprising the image encoding apparatus.

Referring to FIG. 1 , a video encoding apparatus 100 may include apicture partitioner 105, a predictor 110, a residual processer 120, anentropy encoder 130, an adder 140, a filter 150, and a memory 160. Theresidual processer 120 may include a subtractor 121, a transformer 122,a quantizer 123, a re-arranger 124, a dequantizer 125, an inversetransformer 126.

The picture partitioner 105 may split an input picture into at least oneprocessing unit.

In an example, the processing unit may be referred to as a coding unit(CU). In this case, the coding unit may be recursively split from thelargest coding unit (LCU) according to a quad-tree binary-tree (QTBT)structure. For example, one coding unit may be split into a plurality ofcoding units of a deeper depth based on a quadtree structure, a binarytree structure and/or a ternary tree structure. In this case, forexample, the quad tree structure may be first applied and the binarytree structure and ternary tree structure may be applied later.Alternatively, the binary tree structure/ternary tree structure may beapplied first. The coding procedure according to the present embodimentmay be performed based on a final coding unit which is not split anyfurther. In this case, the largest coding unit may be used as the finalcoding unit based on coding efficiency, or the like, depending on imagecharacteristics, or the coding unit may be recursively split into codingunits of a lower depth as necessary and a coding unit having an optimalsize may be used as the final coding unit. Here, the coding proceduremay include a procedure such as prediction, transform, andreconstruction, which will be described later.

In another example, the processing unit may include a coding unit (CU)prediction unit (PU), or a transformer (TU). The coding unit may besplit from the largest coding unit (LCU) into coding units of a deeperdepth according to the quad tree structure. In this case, the largestcoding unit may be directly used as the final coding unit based on thecoding efficiency, or the like, depending on the image characteristics,or the coding unit may be recursively split into coding units of adeeper depth as necessary and a coding unit having an optimal size maybe used as a final coding unit. When the smallest coding unit (SCU) isset, the coding unit may not be split into coding units less than thesmallest coding unit. Here, the final coding unit refers to a codingunit which is partitioned or split to a prediction unit or atransformer. The prediction unit is a unit which is partitioned from acoding unit, and may be a unit of sample prediction. Here, theprediction unit may be divided into sub-blocks. The transformer may bedivided from the coding unit according to the quad-tree structure andmay be a unit for deriving a transform coefficient and/or a unit forderiving a residual signal from the transform coefficient. Hereinafter,the coding unit may be referred to as a coding block (CB), theprediction unit may be referred to as a prediction block (PB), and thetransformer may be referred to as a transform block (TB). The predictionblock or prediction unit may refer to a specific area in the form of ablock in a picture and include an array of prediction samples. Also, thetransform block or transformer may refer to a specific area in the formof a block in a picture and include the transform coefficient or anarray of residual samples.

The predictor 110 may perform prediction on a processing target block(hereinafter, it may represent a current block or a residual block), andmay generate a predicted block including prediction samples for thecurrent block. A unit of prediction performed in the predictor 110 maybe a coding block, or may be a transform block, or may be a predictionblock.

The predictor 110 may determine whether intra-prediction is applied orinter-prediction is applied to the current block. For example, thepredictor 110 may determine whether the intra-prediction or theinter-prediction is applied in unit of CU.

In case of the intra-prediction, the predictor 110 may derive aprediction sample for the current block based on a reference sampleoutside the current block in a picture to which the current blockbelongs (hereinafter, a current picture). In this case, the predictor110 may derive the prediction sample based on an average orinterpolation of neighboring reference samples of the current block(case (i)), or may derive the prediction sample based on a referencesample existing in a specific (prediction) direction as to a predictionsample among the neighboring reference samples of the current block(case (ii)). The case (i) may be called a non-directional mode or anon-angular mode, and the case (ii) may be called a directional mode oran angular mode. In the intra-prediction, prediction modes may includeas an example 33 directional modes and at least two non-directionalmodes. The non-directional modes may include DC mode and planar mode.The predictor 110 may determine the prediction mode to be applied to thecurrent block by using the prediction mode applied to the neighboringblock.

In case of the inter-prediction, the predictor 110 may derive theprediction sample for the current block based on a sample specified by amotion vector on a reference picture. The predictor 110 may derive theprediction sample for the current block by applying any one of a skipmode, a merge mode, and a motion vector prediction (MVP) mode. In caseof the skip mode and the merge mode, the predictor 110 may use motioninformation of the neighboring block as motion information of thecurrent block. In case of the skip mode, unlike in the merge mode, adifference (residual) between the prediction sample and an originalsample is not transmitted. In case of the MVP mode, a motion vector ofthe neighboring block is used as a motion vector predictor to derive amotion vector of the current block.

In case of the inter-prediction, the neighboring block may include aspatial neighboring block existing in the current picture and a temporalneighboring block existing in the reference picture. The referencepicture including the temporal neighboring block may also be called acollocated picture (colPic). Motion information may include the motionvector and a reference picture index. Information such as predictionmode information and motion information may be (entropy) encoded, andthen output as a form of a bit stream.

When motion information of a temporal neighboring block is used in theskip mode and the merge mode, a highest picture in a reference picturelist may be used as a reference picture. Reference pictures included inthe reference picture list may be aligned based on a picture order count(POC) difference between a current picture and a corresponding referencepicture. A POC corresponds to a display order and may be discriminatedfrom a coding order.

The subtractor 121 generates a residual sample which is a differencebetween an original sample and a prediction sample. If the skip mode isapplied, the residual sample may not be generated as described above.

The transformer 122 transforms residual samples in units of a transformblock to generate a transform coefficient. The transformer 122 mayperform transform based on the size of a corresponding transform blockand a prediction mode applied to a coding block or prediction blockspatially overlapping with the transform block. For example, residualsamples may be transformed using discrete sine transform (DST) transformkernel if intra-prediction is applied to the coding block or theprediction block overlapping with the transform block and the transformblock is a 4×4 residual array and is transformed using discrete cosinetransform (DCT) transform kernel in other cases.

The quantizer 123 may quantize the transform coefficients to generatequantized transform coefficients.

The re-arranger 124 rearranges quantized transform coefficients. There-arranger 124 may rearrange the quantized transform coefficients inthe form of a block into a one-dimensional vector through a coefficientscanning method. Although the re-arranger 124 is described as a separatecomponent, the re-arranger 124 may be a part of the quantizer 123.

The entropy encoder 130 may perform entropy-encoding on the quantizedtransform coefficients. The entropy encoding may include an encodingmethod, for example, an exponential Golomb, a context-adaptive variablelength coding (CAVLC), a context-adaptive binary arithmetic coding(CABAC), or the like. The entropy encoder 130 may perform encoding,according to an entropy encoding or according to a pred-configuredmethod, together or separately on information (e.g., a syntax elementvalue or the like) required for video reconstruction in addition to thequantized transform coefficients. The entropy-encoded information may betransmitted or stored in unit of a network abstraction layer (NAL) in abit stream form. The bitstream may be transmitted via a network or bestored in a digital storage medium. Here, the network may include abroadcasting network or a communications network, the digital storagemedium may include various storage medium such as USB, SD, CD, DVD,blue-ray, HDD, SDD and so on.

The dequantizer 125 dequantizes values (transform coefficients)quantized by the quantizer 123 and the inverse transformer 126 inverselytransforms values dequantized by the dequantizer 125 to generate aresidual sample.

The adder 140 adds a residual sample to a prediction sample toreconstruct a picture. The residual sample may be added to theprediction sample in units of a block to generate a reconstructed block.Although the adder 140 is described as a separate component, the adder140 may be a part of the predictor 110. Meanwhile, the adder 140 may bereferred to as a reconstructor or reconstructed block generator.

The filter 150 may apply deblocking filtering and/or a sample adaptiveoffset to the reconstructed picture. Artifacts at a block boundary inthe reconstructed picture or distortion in quantization may be correctedthrough deblocking filtering and/or sample adaptive offset. Sampleadaptive offset may be applied in units of a sample after deblockingfiltering is completed. The filter 150 may apply an adaptive loop filter(ALF) to the reconstructed picture. The ALF may be applied to thereconstructed picture to which deblocking filtering and/or sampleadaptive offset has been applied.

The memory 160 may store a reconstructed picture (decoded picture) orinformation necessary for encoding/decoding. Here, the reconstructedpicture may be the reconstructed picture filtered by the filter 150. Thestored reconstructed picture may be used as a reference picture for(inter) prediction of other pictures. For example, the memory 160 maystore (reference) pictures used for inter-prediction. Here, picturesused for inter-prediction may be designated according to a referencepicture set or a reference picture list.

FIG. 2 briefly illustrates a structure of a video/image decodingapparatus to which the present disclosure is applicable. Hereinafter, avideo decoding apparatus may include an image decoding apparatus.

Referring to FIG. 2 , a video decoding apparatus 200 may include anentropy decoder 210, a residual processer 220, a predictor 230, an adder240, a filter 250, and a memory 260. The residual processer 220 mayinclude a re-arranger 221, a dequantizer 222, an inverse transformer223. In addition, although it is not depicted, the video decodingapparatus 200 may include a receiver for receiving a bitstream includingvideo information. The receiver may be configured as a separate moduleor may be included in the entropy decoder 210.

When a bit stream including video/image information is input, the videodecoding apparatus 200 may reconstruct a video/image/picture inassociation with a process by which video information is processed inthe video encoding apparatus.

For example, the video decoding apparatus 200 may perform video decodingusing a processing unit applied in the video encoding apparatus. Thus,the processing unit block of video decoding may be, for example, acoding unit and, in another example, a coding unit, a prediction unit ora transformer. The coding unit may be split from the largest coding unitaccording to the quad tree structure and/or the binary tree structureand/or ternery tree structure.

A prediction unit and a transformer may be further used in some cases,and in this case, the prediction block is a block derived or partitionedfrom the coding unit and may be a unit of sample prediction. Here, theprediction unit may be divided into sub-blocks. The transformer may besplit from the coding unit according to the quad tree structure and maybe a unit that derives a transform coefficient or a unit that derives aresidual signal from the transform coefficient.

The entropy decoder 210 may parse the bit stream to output informationrequired for video reconstruction or picture reconstruction. Forexample, the entropy decoder 210 may decode information in the bitstream based on a coding method such as exponential Golomb encoding,CAVLC, CABAC, or the like, and may output a value of a syntax elementrequired for video reconstruction and a quantized value of a transformcoefficient regarding a residual.

More specifically, a CABAC entropy decoding method may receive a bincorresponding to each syntax element in a bit stream, determine acontext model using decoding target syntax element information anddecoding information of neighboring and decoding target blocks orinformation of symbol/bin decoded in a previous step, predict bingeneration probability according to the determined context model andperform arithmetic decoding of the bin to generate a symbolcorresponding to each syntax element value. Here, the CABAC entropydecoding method may update the context model using information of asymbol/bin decoded for a context model of the next symbol/bin afterdetermination of the context model.

Information about prediction among information decoded in the entropydecoder 210 may be provided to the predictor 250 and residual values,that is, quantized transform coefficients, on which entropy decoding hasbeen performed by the entropy decoder 210 may be input to there-arranger 221.

The re-arranger 221 may rearrange the quantized transform coefficientsinto a two-dimensional block form. The re-arranger 221 may performrearrangement corresponding to coefficient scanning performed by theencoding apparatus. Although the re-arranger 221 is described as aseparate component, the re-arranger 221 may be a part of the dequantizer222.

The dequantizer 222 may de-quantize the quantized transform coefficientsbased on a (de)quantization parameter to output a transform coefficient.In this case, information for deriving a quantization parameter may besignaled from the encoding apparatus.

The inverse transformer 223 may inverse-transform the transformcoefficients to derive residual samples.

The predictor 230 may perform prediction on a current block, and maygenerate a predicted block including prediction samples for the currentblock. A unit of prediction performed in the predictor 230 may be acoding block or may be a transform block or may be a prediction block.

The predictor 230 may determine whether to apply intra-prediction orinter-prediction based on information about a prediction. In this case,a unit for determining which one will be used between theintra-prediction and the inter-prediction may be different from a unitfor generating a prediction sample. In addition, a unit for generatingthe prediction sample may also be different in the inter-prediction andthe intra-prediction. For example, which one will be applied between theinter-prediction and the intra-prediction may be determined in unit ofCU. In addition, for example, in the inter-prediction, the predictionsample may be generated by determining the prediction mode in unit ofPU, and in the intra-prediction, the prediction sample may be generatedin unit of TU by determining the prediction mode in unit of PU.

In case of the intra-prediction, the predictor 230 may derive aprediction sample for a current block based on a neighboring referencesample in a current picture. The predictor 230 may derive the predictionsample for the current block by applying a directional mode or anon-directional mode based on the neighboring reference sample of thecurrent block. In this case, a prediction mode to be applied to thecurrent block may be determined by using an intra-prediction mode of aneighboring block.

In the case of inter-prediction, the predictor 230 may derive aprediction sample for a current block based on a sample specified in areference picture according to a motion vector. The predictor 230 mayderive the prediction sample for the current block using one of the skipmode, the merge mode and the MVP mode. Here, motion information requiredfor inter-prediction of the current block provided by the video encodingapparatus, for example, a motion vector and information about areference picture index may be acquired or derived based on theinformation about prediction.

In the skip mode and the merge mode, motion information of a neighboringblock may be used as motion information of the current block. Here, theneighboring block may include a spatial neighboring block and a temporalneighboring block.

The predictor 230 may construct a merge candidate list using motioninformation of available neighboring blocks and use informationindicated by a merge index on the merge candidate list as a motionvector of the current block. The merge index may be signaled by theencoding apparatus. Motion information may include a motion vector and areference picture. In the skip mode and the merge mode, a firtly-orderedpicture in the reference picture list may be used as a reference picturewhen motion information of a temporal neighboring block is used.

In the case of the skip mode, a difference (residual) between aprediction sample and an original sample is not transmitted,distinguished from the merge mode.

In the case of the MVP mode, the motion vector of the current block maybe derived using a motion vector of a neighboring block as a motionvector predictor. Here, the neighboring block may include a spatialneighboring block and a temporal neighboring block.

When the merge mode is applied, for example, a merge candidate list maybe generated using a motion vector of a reconstructed spatialneighboring block and/or a motion vector corresponding to a Col blockwhich is a temporal neighboring block. A motion vector of a candidateblock selected from the merge candidate list is used as the motionvector of the current block in the merge mode. The aforementionedinformation about prediction may include a merge index indicating acandidate block having the best motion vector selected from candidateblocks included in the merge candidate list. Here, the predictor 230 mayderive the motion vector of the current block using the merge index.

When the MVP (Motion vector Prediction) mode is applied as anotherexample, a motion vector predictor candidate list may be generated usinga motion vector of a reconstructed spatial neighboring block and/or amotion vector corresponding to a Col block which is a temporalneighboring block. That is, the motion vector of the reconstructedspatial neighboring block and/or the motion vector corresponding to theCol block which is the temporal neighboring block may be used as motionvector candidates. The aforementioned information about prediction mayinclude a prediction motion vector index indicating the best motionvector selected from motion vector candidates included in the list.Here, the predictor 230 may select a prediction motion vector of thecurrent block from the motion vector candidates included in the motionvector candidate list using the motion vector index. The predictor ofthe encoding apparatus may obtain a motion vector difference (MVD)between the motion vector of the current block and a motion vectorpredictor, encode the MVD and output the encoded MVD in the form of abit stream. That is, the MVD may be obtained by subtracting the motionvector predictor from the motion vector of the current block. Here, thepredictor 230 may acquire a motion vector included in the informationabout prediction and derive the motion vector of the current block byadding the motion vector difference to the motion vector predictor. Inaddition, the predictor may obtain or derive a reference picture indexindicating a reference picture from the aforementioned information aboutprediction.

The adder 240 may add a residual sample to a prediction sample toreconstruct a current block or a current picture. The adder 240 mayreconstruct the current picture by adding the residual sample to theprediction sample in units of a block. When the skip mode is applied, aresidual is not transmitted and thus the prediction sample may become areconstructed sample. Although the adder 240 is described as a separatecomponent, the adder 240 may be a part of the predictor 230. Meanwhile,the adder 240 may be referred to as a reconstructor reconstructed blockgenerator.

The filter 250 may apply deblocking filtering, sample adaptive offsetand/or ALF to the reconstructed picture. Here, sample adaptive offsetmay be applied in units of a sample after deblocking filtering. The ALFmay be applied after deblocking filtering and/or application of sampleadaptive offset.

The memory 260 may store a reconstructed picture (decoded picture) orinformation necessary for decoding. Here, the reconstructed picture maybe the reconstructed picture filtered by the filter 250. For example,the memory 260 may store pictures used for inter-prediction. Here, thepictures used for inter-prediction may be designated according to areference picture set or a reference picture list. A reconstructedpicture may be used as a reference picture for other pictures. Thememory 260 may output reconstructed pictures in an output order.

Meanwhile, as described above, in performing video coding, prediction isperformed to improve compression efficiency. Through this, a predictedblock including prediction samples for a current block as a block to becoded (i.e., a coding target block) may be generated. Here, thepredicted block includes prediction samples in a spatial domain (orpixel domain). The predicted block is derived in the same manner in anencoding apparatus and a decoding apparatus, and the encoding apparatusmay signal information (residual information) on residual between theoriginal block and the predicted block, rather than an original samplevalue of an original block, to the decoding apparatus, therebyincreasing image coding efficiency. The decoding apparatus may derive aresidual block including residual samples based on the residualinformation, add the residual block and the predicted block to generatereconstructed blocks including reconstructed samples, and generate areconstructed picture including the reconstructed blocks.

The residual information may be generated through a transform andquantization procedure. For example, the encoding apparatus may derive aresidual block between the original block and the predicted block,perform a transform procedure on residual samples (residual samplearray) included in the residual block to derive transform coefficients,perform a quantization procedure on the transform coefficients to derivequantized transform coefficients, and signal related residualinformation to the decoding apparatus (through a bit stream). Here, theresidual information may include value information of the quantizedtransform coefficients, location information, a transform technique, atransform kernel, a quantization parameter, and the like. The decodingapparatus may perform dequantization/inverse transform procedure basedon the residual information and derive residual samples (or residualblocks). The decoding apparatus may generate a reconstructed picturebased on the predicted block and the residual block. Also, for referencefor inter-prediction of a picture afterward, the encoding apparatus mayalso dequantize/inverse-transform the quantized transform coefficientsto derive a residual block and generate a reconstructed picture basedthereon.

FIG. 3 schematically illustrates a multiple transform techniqueaccording to the present disclosure.

Referring to FIG. 3 , a transformer may correspond to the transformer inthe aforementioned encoding apparatus of FIG. 1 , and an inversetransformer may correspond to the aforementioned inverse transformer inthe encoding apparatus of FIG. 1 or the aforementioned inversetransformer in the decoding apparatus of FIG. 2 .

The transformer may derive (primary) transform coefficients byperforming a primary transform based on residual samples (residualsample array) in the residual block (S310). Here, the primary transformmay include a multiple transform set (MTS). The multiple transform setmay also be referred to as an adaptive multiple core transform in somecases.

The adaptive multiple core transform may represent a method forperforming a transform additionally using a Discrete Cosine Transform(DCT) type 2, a Discrete Sine Transform (DST) type 7, a DCT type 8,and/or a DST type 1. That is, the multiple core transform may representa transform method for transforming a residual signal (or a residualblock) in the spatial domain into transform coefficients (or primarytransform coefficients) in the frequency domain based on a plurality oftransform kernels which are selected from the DCT type 2, the DST type7, the DCT type 8, and the DST type 1. Here, the primary transformcoefficients may be referred to as temporary transform coefficients fromthe viewpoint of the transformer.

That is, if the existing transform method is applied, the transform fromthe spatial domain to the frequency domain for the residual signal (orthe residual block) may be applied based on the DCT type 2 to generatethe transform coefficients. On the other hand, if the adaptive multiplecore transform is applied, the transform from the spatial domain to thefrequency domain for the residual signal (or the residual block) may beapplied based on the DCT type 2, the DST type 7, the DCT type 8, and/orthe DST type 1 or the like to generate the transform coefficients (orthe primary transform coefficients). Here, the DCT type 2, the DST type7, the DCT type 8, the DST type 1, and the like may be referred to as atransform type, a transform kernel, or a transform core.

For reference, the DCT/DST transform types may be defined based on basisfunctions, and the basis functions may be represented as shown in thefollowing table.

TABLE 1 Transform Type Basis function T_(i)(j), i, j = 0, 1, . . . , N −1 DCT-II    ${T_{i}(j)} = {\omega_{0} \cdot \sqrt{\frac{2}{N}} \cdot {\cos\left( \frac{\pi \cdot i \cdot \left( {{2j} + 1} \right)}{2N} \right)}}$${{where}\mspace{14mu}\omega_{0}} = \left\{ \begin{matrix}\sqrt{\frac{2}{N}} & {i = 0} \\1 & {i \neq 0}\end{matrix} \right.$ DCT-V${{T_{i}(j)} = {\omega_{0} \cdot \omega_{1} \cdot \sqrt{\frac{2}{{2N} - 1}} \cdot {\cos\left( \frac{2{\pi \cdot i \cdot j}}{{2N} - 1} \right)}}},$${{where}\mspace{14mu}\omega_{0}} = \left\{ {\begin{matrix}\sqrt{\frac{2}{N}} & {i = 0} \\1 & {i \neq 0}\end{matrix},{\omega_{1} = \left\{ \begin{matrix}\sqrt{\frac{2}{N}} & {j = 0} \\1 & {j \neq 0}\end{matrix} \right.}} \right.$ DCT-VIII${T_{i}(j)} = {\sqrt{\frac{4}{{2N} + 1}} \cdot {\cos\left( \frac{\pi \cdot \left( {{2i} + 1} \right) \cdot \left( {{2j} + 1} \right)}{{4N} + 2} \right)}}$DST-I${T_{i}(j)} = {\sqrt{\frac{2}{N + 1}} \cdot {\sin\left( \frac{\pi \cdot \left( {i + 1} \right) \cdot \left( {j + 1} \right)}{N + 1} \right)}}$DST-VII${T_{i}(j)} = {\sqrt{\frac{4}{{2N} + 1}} \cdot {\sin\left( \frac{\pi \cdot \left( {{2i} + 1} \right) \cdot \left( {j + 1} \right)}{{2N} + 1} \right)}}$

If the adaptive multiple core transform is performed, a verticaltransform kernel and a horizontal transform kernel for a target blockamong the transform kernels may be selected, and a vertical transformfor the target block may be performed based on the vertical transformkernel, and a horizontal transform for the target block may be performedbased on the horizontal transform kernel. Here, the horizontal transformmay represent a transform for horizontal components of the target block,and the vertical transform may represent a transform for verticalcomponents of the target block. The vertical transform kernel/thehorizontal transform kernel may be adaptively determined based on aprediction mode of the target block (CU or sub-block) which encompassesthe residual block and/or a transform index indicating a transformsubset.

The transformer may derive (secondary) transform coefficients byperforming a secondary transform based on the (primary) transformcoefficients (S320). If the primary transform is the transform from thespatial domain to the frequency domain, the secondary transform may beregarded as the transform from the frequency domain to the frequencydomain. The secondary transform may include a non-separable transform.In this case, the secondary transform may be referred to as anon-separable secondary transform (NSST). The non-separable secondarytransform may represent the transform which generates transformcoefficients (or secondary transform coefficients) for the residualsignal by secondarily transforming the (primary) transform coefficientsderived through the primary transform based on a non-separable transformmatrix. Here, the transform may be applied at once based on thenon-separable transform matrix without separately applying the verticaltransform and the horizontal transform (or without independentlyapplying the horizontal and vertical transform) to the (primary)transform coefficients. That is, the non-separable secondary transformmay represent the transform method which generates the transformcoefficients (or the secondary transform coefficients) by transformingthe vertical component and the horizontal component of the (primary)transform coefficients together without separating them based on thenon-separable transform matrix. The non-separable secondary transformmay be applied to a top-left area of a block composed of the (primary)transform coefficients (hereinafter, referred to as a transformcoefficient block). For example, if both the width (W) and the height(H) of the transform coefficient block are 8 or more, an 8×8non-separable secondary transform may be applied to the top-left 8×8area of the transform coefficient block. In addition, if both the width(W) and the height (H) of the transform coefficient block are 4 or moreand the width (W) or the height (H) of the transform coefficient blockis less than 8, a 4×4 non-separable secondary transform may be appliedto a top-left min (8, W)×min (8, H) area of the transform coefficientblock. However, an exemplary embodiment is not limited thereto, and forexample, if only a condition in which the width (W) or the height (H) ofthe transform coefficient block is less than 8 is satisfied, the 4×4non-separable secondary transform may also be applied to the top-leftmin (8, W)×min (8, H) area of the transform coefficient block.

Specifically, for example, when a 4×4 input block is used, NSST may beperformed as follows.

The 4×4 input block X may be represented as follows.

$\begin{matrix}{X = \begin{bmatrix}X_{00} & X_{01} & X_{02} & X_{03} \\X_{10} & X_{11} & X_{12} & X_{13} \\X_{20} & X_{21} & X_{22} & X_{23} \\X_{30} & X_{31} & X_{32} & X_{33}\end{bmatrix}} & \left\lbrack {{Equation}\mspace{14mu} 1} \right\rbrack\end{matrix}$

When X is expressed in a vector form, a vector

may be represented as follows.

=[X ₀₀ X ₀₁ X ₀₂ X ₀₃ X ₁₀ X ₁₁ X ₁₂ X ₁₃ X ₂₀ X ₂₁ X ₂₂ X ₂₃ X ₃₀ X ₃₁X ₃₂ X ₃₃]^(T)  [Equation 2]

In this case, the non-separable secondary transform may be calculated by

=T·

. Where

denotes a transform coefficient vector, and T denotes a 16×16(non-separable) transform matrix.

A 16×1 transform coefficient vector

may be re-organized as 4×4 blocks through a scan order (horizontal,vertical, diagonal, or the like). However, the aforementionedcalculation is an example and hypercube-givens transform (HyGT) or thelike may also be used for calculation of the non-separable secondarytransform to reduce calculation complexity of the non-separablesecondary transform.

Meanwhile, in the non-separable secondary transform, a transform kernel(or transform core, transform type) may be selected mode-dependently.Here, the mode may include an intra-prediction mode and/or aninter-prediction mode.

As described above, the non-separable secondary transform may beperformed based on the 8×8 transform or the 4×4 transform determinedbased on the width (W) and height (H) of the transform coefficientblock. That is, the NSST may be performed based on an 8×8 subblock sizeor a 4×4 subblock size. For example, in order to select the mode-basedtransform kernel, 35 sets of three non-separable secondary transformkernels may be configured for non-separable secondary transform for both8×8 subblock size and 4×4 subblock size. That is, 35 transform sets maybe configured for the 8×8 sub-block size, and 35 transform sets may beconfigured for the 4×4 sub-block size. In this case, the 35 transformsets for the 8×8 subblock size may include 3 8×8 transform kernels,respectively, and in this case, the 35 transform sets for the 4×4subblock size may include 3 4×4 transform kernels. However, the size ofthe transform subblock, the number of sets, and the number of transformkernels in the set are an example and a size other than 8×8 or 4×4 maybe used, or n sets may be configured and k transform kernels may beincluded in each set.

The transform set may also be referred to as a NSST set, and thetransform kernel in the NSST set may be referred to as a NSST kernel.Selection of a specific one of the transform sets may be performed, forexample, based on an intra prediction mode of a target block (CU orsubblock).

For a reference, for example, the intra prediction mode may include twonon-directional or non-angular intra prediction modes and 65 directionalor angular intra-prediction modes. The non-directional intra predictionmodes may include a planar intra prediction mode #0 and a DC intraprediction mode #1, and the directional intra prediction modes mayinclude 65 intra prediction modes #2 to #66. However, this is an exampleand the present disclosure may also be applied even when the number ofintra prediction modes is different. Meanwhile, the intra predictionmode #67 may be further used in some cases, and the intra predictionmode #67 may represent a linear model (LM) mode.

In the intra prediction mode #67 according to an exemplary embodiment,an intra prediction mode having the horizontal directionality and anintra prediction mode having the vertical directionality may beclassified with respect to the intra prediction mode #34 having atop-left diagonal prediction direction. The intra prediction modes #2 to#33 have the horizontal directionality, and the intra prediction modes#34 to #66 have the vertical directionality. The intra prediction mode#18 and the intra prediction mode #50 represent a horizontal intraprediction mode and a vertical intra prediction mode, respectively, andthe intra prediction mode #2 may be referred to as a left downwarddiagonal intra prediction mode, the intra prediction mode #34 may bereferred to as a top-left diagonal intra prediction mode, and the intraprediction mode #66 may be referred to as a top-right diagonal intraprediction mode.

In this case, mapping between the 35 transform sets and the intraprediction modes may be represented, for example, as shown in thefollowing table. For reference, when the LM mode is applied to a targetblock, the secondary transform may not be applied to the target block.

TABLE 2 intra mode 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 set 0 1 23 4 5 6 7 8 9 10 11 12 13 14 15 16 17 intra mode 34 35 36 37 38 39 40 4142 43 44 45 46 47 48 49 50 51 set 34 33 32 31 30 29 28 27 26 25 24 23 2221 20 19 18 17 intra mode 18 19 20 21 22 23 24 25 26 27 28 29 30 31 3233 set 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 intra mode 52 5354 55 56 57 58 59 60 61 62 63 64 65 66 67 (LM) set 16 15 14 13 12 11 109 8 7 6 5 4 3 2 NULL

Meanwhile, when it is determined that a specific set is used, one of ktransform kernels in the specific set may be selected through a NSSTindex. The encoding apparatus may derive a NSST index indicating aspecific transform kernel based on a rate-distortion (RD) check and maysignal the NSST index to the decoding apparatus. The decoding apparatusmay select one of k transform kernels in the specific set based on theNSST index. For example, NSST index value 0 may indicate a first NSSTkernel, NSST index value 1 may indicate a second NSST kernel, and NSSTindex value 2 may indicate the third NSST kernel. Alternatively, theNSST index value 0 may indicate that the first NSST is not applied tothe target block, and the NSST index values 1 to 3 may indicate thethree transform kernels.

Referring back to FIG. 3 , the transformer may perform the NSST based onthe selected transform kernels and obtain (secondary) transformcoefficients. The transform coefficients may be derived as quantizedtransform coefficients through the quantizer as described above, andencoded and signaled to the decoding apparatus and delivered to thedequantizer/inverse-transformer in the encoding apparatus.

Meanwhile, when the secondary transform is omitted as described above,the (primary) transform coefficients, which are outputs of the primary(separable) transform, may be derived as quantized transformcoefficients through the quantizer as described above and may be encodedand signaled to the decoding apparatus and delivered to thedequantizer/inverse-transformer in the encoding apparatus.

The inverse transformer may perform a series of procedures in a reverseorder of the procedure performed by the transformer described above. Theinverse transformer may receive (inverse-quantized) transformcoefficients, perform secondary (inverse) transform to derive (primary)transform coefficients (S350), and perform primary (inverse) transformon the (primary) transform coefficients to acquire a residual block(residual samples). Here, the primary transform coefficients may bereferred to as modified transform coefficients from the viewpoint of theinverse transformer. As described above, the encoding apparatus and thedecoding apparatus may generate a reconstructed block based on theresidual block and the predicted block and generate a reconstructedpicture based on the reconstructed block.

Meanwhile, as described above, when the secondary (inverse) transform isomitted, the (dequantized) transform coefficients may be received andthe primary (separable) transform may be performed thereon to acquire aresidual block (residual samples). As described above, the encodingapparatus and the decoding apparatus may generate a reconstructed blockbased on the residual block and the predicted block and generate areconstructed picture based on the reconstructed block.

FIGS. 4A and 4B are flowcharts illustrating a coding process oftransform coefficients according to an exemplary embodiment.

Each step illustrated in FIGS. 4A and 4B may be performed by theencoding apparatus 100 or the decoding apparatus 200 illustrated inFIGS. 1 and 2 , and more specifically, may be performed by the entropyencoder 130 illustrated in FIG. 1 and the entropy decoder 210illustrated in FIG. 2 . Accordingly, detailed descriptions overlappingwith the aforementioned contents in FIG. 1 or 2 will be omitted orsimplified.

In the present specification, terms or sentences are used to definespecific information or concepts. For example, in the presentspecification, “a flag representing whether at least one non-zerotransform coefficient among transform coefficients for the target blockexists” is expressed as cbf. However, since the “cbf” may be replacedwith various terms such as coded_block_flag, the term or sentence usedto define specific information or concepts in the present specificationshould not be interpreted as being limited to the name thereof ininterpreting the term or sentence throughout the specification, and itis necessary to pay attention to and interpret various operations,functions, and effects according to the meaning of the term.

FIG. 4A illustrates an encoding process of transform coefficients.

The encoding apparatus 100 according to an exemplary embodiment maydetermine whether a flag representing whether at least one non-zerotransform coefficient exists among the transform coefficients for thetarget block indicates 1 (S400). If the flag representing whether atleast one non-zero transform coefficient exists among the transformcoefficients for the target block indicates 1, at least one non-zerotransform coefficient among the transform coefficients for the targetblock may exist. Conversely, if the flag representing whether at leastone non-zero transform coefficient exists among the transformcoefficients for the target block indicates 0, the transformcoefficients for the target block may all indicate 0.

The flag representing whether at least one non-zero transformcoefficient exists among the transform coefficients for the target blockmay be expressed as, for example, a cbf flag. The cbf flag may includecbf_luma[x0][y0][trafoDepth] flag for the luma block and cbf_cb[x0][y0][trafoDepth] and cbf_cr[x0][y0] [trafoDepth] flags for the chroma block.Here, the array indices x0 and y0 may mean the location of the top-leftluma/chroma sample of the target block with respect to the top-leftluma/chroma sample of the current picture, and the array indextrafoDepth may mean a level at which the coding block is divided for thepurpose of transform coding. If the blocks in which the trafoDepthindicates 0 correspond to the coding block and the coding block and thetransform block are defined identically, the trafoDepth may be regardedas 0.

The encoding apparatus 100 according to an exemplary embodiment mayencode information about the transform coefficients for the targetblock, if the flag representing whether at least one non-zero transformcoefficient exists among the transform coefficients for the target blockindicates 1 in S400 (S410).

The information about the transform coefficients for the target blockincludes, for example, at least one of information about the location ofthe last non-zero transform coefficient, group flag informationindicating whether the non-zero transform coefficient is included in asubgroup of the target block, and information about a reducedcoefficient. The detailed description of each information will bedescribed later.

The encoding apparatus 100 according to an exemplary embodiment maydetermine whether a condition for performing the NSST is satisfied(S420). More specifically, the encoding apparatus 100 may determinewhether a condition for encoding the NSST index is satisfied. At thistime, the NSST index may be referred to as a transform index, forexample.

The encoding apparatus 100 according to an exemplary embodiment mayencode the NSST index if it is determined that the condition forperforming the NSST is satisfied in S420 (S430). More specifically, ifit is determined that the condition for encoding the NSST index issatisfied, the encoding apparatus 100 may encode the NSST index.

The encoding apparatus 100 according to an exemplary embodiment may omitthe operations of the S410, S420, and S430, if the flag representingwhether at least one non-zero transform coefficient exists among thetransform coefficients for the target block indicates 0 in S400.

In addition, the encoding apparatus 100 according to an exemplaryembodiment may omit the operation of the S430, if it is determined thatthe condition for performing the NSST is not satisfied in S420.

FIG. 4B illustrates a decoding process of the transform coefficients.

The decoding apparatus 200 according to an exemplary embodiment maydetermine whether the flag representing whether at least one non-zerotransform coefficient exists among the transform coefficients for thetarget block indicates 1 (S440). If the flag representing whether atleast one non-zero transform coefficient exists among the transformcoefficients for the target block indicates 1, at least one non-zerotransform coefficient among the transform coefficients for the targetblock may exist. Conversely, if the flag representing whether at leastone non-zero transform coefficient exists among the transformcoefficients for the target block indicates 0, the transformcoefficients for the target block may all represent 0.

The decoding apparatus 200 according to an exemplary embodiment maydecode the information about the transform coefficients for the targetblock, if the flag representing whether at least one non-zero transformcoefficient exists among the transform coefficients for the target blockindicates 1 in S440 (S450).

The decoding apparatus 200 according to an exemplary embodiment maydetermine whether the condition for performing the NSST is satisfied(S460). More specifically, the decoding apparatus 200 may determinewhether a condition for decoding the NSST index from a bitstream issatisfied.

The decoding apparatus 200 according to an exemplary embodiment maydecode the NSST index, if it is determined in S460 that the conditionfor performing the NSST is satisfied (S470).

The decoding apparatus 200 according to an exemplary embodiment may omitthe operations of the S450, S460, and S470, if the flag representingwhether at least one non-zero transform coefficient exists among thetransform coefficients for the target block in S440 indicates 0.

In addition, the decoding apparatus 200 according to an exemplaryembodiment may omit the operation of the S470, if it is determined inS460 that the condition for performing the NSST is not satisfied.

FIGS. 5A and 5B are flowcharts specifically illustrating a codingprocess of transform coefficients according to an exemplary embodiment.

Each step illustrated in FIGS. 5A and 5B may be performed by theencoding apparatus 100 or the decoding apparatus 200 illustrated inFIGS. 1 and 2 , and more specifically, may be performed by the entropyencoder 130 illustrated in FIG. 1 and the entropy decoder 210illustrated in FIG. 2 . In addition, S505 of FIG. 5A may correspond tothe S400 of FIG. 4A, and S555 of FIG. 5B may correspond to the S440 ofFIG. 4B. Accordingly, detailed descriptions overlapping with thecontents described above with reference to FIGS. 1, 2, 4A, and 4B willbe omitted or simplified.

FIG. 5A specifically illustrates the encoding process of the transformcoefficients.

The encoding apparatus 100 according to an exemplary embodiment mayencode the flag representing whether at least one non-zero transformcoefficient exists among the transform coefficients for the target block(S500). For example, the encoding apparatus 100 may encode the cbf flag.

The encoding apparatus 100 according to an exemplary embodiment maydetermine whether the flag representing whether at least one non-zerotransform coefficient exists among the transform coefficients for thetarget block indicates 1 (S505).

The encoding apparatus 100 according to an exemplary embodiment mayencode the information about the location of the last non-zero transformcoefficient, if the flag representing whether at least one non-zerotransform coefficient exists among the transform coefficients for thetarget block indicates 1 in S505 (S510).

The last non-zero transform coefficient may mean a non-zero transformcoefficient which is lastly derived when the target block is scanned ina specific scanning order. That is, the last non-zero transformcoefficient may be a non-zero transform coefficient which is derived forthe first time when the target block is inversely scanned based on aspecific scanning order. Here, the specific scanning order may include,for example, a top-right diagonal scanning order, a Z-scanning order (ora raster scanning order), and the like and is not limited thereto.

The location of the last non-zero transform coefficient may mean, forexample, a coordinates (x, y) with respect to the x-axis directionlocation and the y-axis direction location of the last non-zerotransform coefficient. The (x, y) may mean the location of the lastnon-zero transform coefficient of the corresponding block when thelocation of the top-left luma/chroma sample of the current picture isset as (0, 0).

The information about the location of the last non-zero transformcoefficient may be signaled through various field names such as alast_sig_coeff_x_prefix field, a last_sig_coeff_y_prefix field, alast_sig_coeff_x_suffix field, a last_sig_coeff_y_suffix field, alast_sig_coeff_x, field, a last_sig_coeff_y field, and alast_sig_coeff_(x,y) field, and the examples are not limited thereto.

The target block according to an exemplary embodiment may include atleast one subgroup. The subgroups (or the sub-blocks) included in thetarget block may each have the same sizes, and may have a square shapeor a rectangular shape. For example, a 16×16 target block may include 164×4 subgroups. However, this is only an example, and for example, thesizes of the respective subgroups included in the target block may bedifferent from each other, and the subgroups may also have anon-rectangular shape.

As an example, a subgroup index may be assigned based on the top-rightdiagonal scanning order. At this time, the subgroup index of thesubgroup located at the top-left of the target block may be assigned as0, and the subgroup index of the subgroup located at the bottom-right ofthe target block may be assigned as n−1 (where n is the total number ofsubgroups of the target block).

The encoding apparatus 100 according to an exemplary embodiment mayfirst start a subgroup having a subgroup index of n−1 (S515) to performoperations of S520 to S535 with respect to all of the subgroups of thetarget block while decreasing the subgroup index by 1 (S545). Theoperations of the S520 to the S535 may be repeated until the subgroupindex becomes 0 (S540).

The encoding apparatus 100 according to an exemplary embodiment maydetermine whether it is necessary to encode group flag information ofthe subgroup when following a group condition (S520). The group flaginformation of the subgroup may represent whether the subgroup includesthe non-zero transform coefficient. The group flag information may besignaled through various field names such as Group_Flag, group_flag,subgroup_flag, subblock_flag, and coded_sub_block_flag, and the examplesare not limited thereto.

The encoding apparatus 100 may determine that it is necessary to encodethe group flag information of the subgroup other than the first subgroup(the subgroup index 0) and the last subgroup (the subgroup index n−1,where n is the total number of subgroups of the target block) of thetarget block based on the group condition. The encoding apparatus 100may determine that the group flag information of the first subgroup andthe last subgroup need not be encoded according to the group condition,because the group flags of the first subgroup and the last subgroup ofthe target block are determined as 1.

The encoding apparatus 100 according to an exemplary embodiment mayencode the group flag information of the subgroup, if it is determinedin S520 that it is necessary to encode the group flag information of thesubgroup (S525).

The encoding apparatus 100 according to an exemplary embodiment may omitthe operation of the S525, if it is determined in S520 that it is notnecessary to encode the group flag information of the subgroup. Forexample, the encoding apparatus 100 may omit the encoding of the groupflag information of the first subgroup and the last subgroup, whileregarding the group flags of the first subgroup (the subgroup index 0)and the last subgroup (the subgroup index n−1) of the target block as 1.

The encoding apparatus 100 according to an exemplary embodiment maydetermine whether the group flag of the subgroup indicates 1 (S530).

The encoding apparatus 100 according to an exemplary embodiment mayencode a value (or level) of each of the transform coefficients includedin the subgroup, if the group flag of the subgroup indicates 1 in S530(S535).

The encoding apparatus 100 according to an exemplary embodiment may omitthe operation of the S535, if the group flag of the subgroup indicates 0in S530. More specifically, if the group flag of the subgroup indicates0, the encoding apparatus 100 may determine the transform coefficientsincluded in the subgroup as 0, respectively, and accordingly, theencoding for the value of each of the transform coefficients included inthe subgroup may be omitted.

The encoding apparatus 100 according to an exemplary embodiment may omitthe operations of the S510 to S545, if the flag representing whether atleast one non-zero transform coefficient exists among the transformcoefficients for the target block indicates 0 in S505.

Meanwhile, those skilled in the art will readily understand that theS510 to the S545 are detailed operations included in the S410 of FIG.4A.

FIG. 5B specifically illustrates a decoding process of transformcoefficients.

The decoding apparatus 200 according to an exemplary embodiment maydecode the flag representing whether at least one non-zero transformcoefficient exists among the transform coefficients for the target block(S550). For example, the decoding apparatus 200 may decode the cbf flag.

The decoding apparatus 200 according to an exemplary embodiment maydetermine whether the flag representing whether at least one non-zerotransform coefficient exists among the transform coefficients for thetarget block indicates 1 (S555).

The decoding apparatus 200 according to an exemplary embodiment maydecode the information about the location of the last non-zero transformcoefficient, if the flag representing whether at least one non-zerotransform coefficient exists among the transform coefficients for thetarget block indicates 1 in the S555 (S560).

The decoding apparatus 200 according to an exemplary embodiment mayfirst start a subgroup in which the subgroup index is n−1 (where n isthe total number of subgroups of the target block) (S565) to perform theoperations of S570 to S585 with respect to all of the subgroups of thetarget block, while decreasing the subgroup index by 1 (S595). Theoperations of the S570 to the S585 may be repeated until the subgroupindex becomes 0 (S590).

The decoding apparatus 200 according to an exemplary embodiment maydetermine whether it is necessary to decode the group flag of thesubgroup (S570).

The decoding apparatus 200 may determine that it is necessary to decodethe group flag information of the subgroup other than the first subgroup(the subgroup index 0) and the last subgroup (the subgroup index n−1,where n is the total number of subgroups of the target block) of thetarget block based on the group condition. The decoding apparatus 200may determine that it is not necessary to decode the group flaginformation of the first subgroup and the last subgroup according to thegroup condition, because the group flags of the first subgroup and thelast subgroup of the target block are determined as 1.

The decoding apparatus 200 according to an exemplary embodiment maydecode the group flag of the subgroup, if it is determined in the S570that it is necessary to decode the group flag of the subgroup (S575).

The decoding apparatus 200 according to an exemplary embodiment may omitthe operation of the S575, if it is determined in the S570 that it isnot necessary to decode the group flag of the subgroup. For example, thedecoding apparatus 200 may omit the decoding of the group flaginformation of the first subgroup and the last subgroup, while regardingthe group flags of the first subgroup (the subgroup index 0) and thelast subgroup (the subgroup index n−1) of the target block as 1.

The decoding apparatus 200 according to an exemplary embodiment maydetermine whether the group flag of the subgroup indicates 1 (S580).

The decoding apparatus 200 according to an exemplary embodiment maydecode a value (or level) of each of the transform coefficients includedin the subgroup, if the group flag of the subgroup indicates 1 in theS575 (S585).

The decoding apparatus 200 according to an exemplary embodiment may omitthe operation of the S585, if the group flag of the subgroup indicates 0in the S580. More specifically, if the group flag of the subgroupindicates 0, the decoding apparatus 200 may determine the transformcoefficients included in the subgroup as 0, respectively, andaccordingly, omit the decoding for the value of each of the transformcoefficients included in the subgroup.

The decoding apparatus 200 according to an exemplary embodiment may omitthe operations of the S560 to the S595, if the flag representing whetherat least one non-zero transform coefficient exists among the transformcoefficients for the target block indicates 0 in the S555.

Meanwhile, those skilled in the art will readily understand that theS560 to the S595 are detailed operations included in the S450 of FIG.4B.

FIGS. 6A and 6B are flowcharts illustrating a process of codingtransform coefficients according to an exemplary embodiment of thepresent disclosure.

Each step illustrated in FIGS. 6A and 6B may be performed by theencoding apparatus 100 or the decoding apparatus 200 illustrated inFIGS. 1 and 2 , and more specifically, may be performed by the entropyencoder 130 illustrated in FIG. 1 and the entropy decoder 210illustrated in FIG. 2 . In addition, S600 and S620 of FIG. 6A maycorrespond to the S400 and the S430 of FIG. 4A, respectively, and S640and S660 of FIG. 6B may correspond to the S440 and the S470 of FIG. 4B.Accordingly, detailed descriptions overlapping with the contentsdescribed above with reference to FIGS. 1, 2, 4A, and 4B will be omittedor simplified.

FIG. 6A illustrates an encoding process of transform coefficientsaccording to an exemplary embodiment of the present disclosure.

The encoding apparatus 100 according to an exemplary embodiment maydetermine whether the flag representing whether at least one non-zerotransform coefficient exists among the transform coefficients for thetarget block indicates 1 (S600).

The encoding apparatus 100 according to an exemplary embodiment maydetermine whether the condition for performing the NSST is satisfied, ifthe flag representing whether at least one non-zero transformcoefficient among the transform coefficients for the target block existsindicates 1 in the S600 (S610). More specifically, if the flagrepresenting whether at least one non-zero transform coefficient amongthe transform coefficients for the target block exists indicates 1 inthe S600, the encoding apparatus 100 may determine whether the conditionfor performing the NSST index is satisfied.

The encoding apparatus 100 according to an exemplary embodiment mayencode the NSST index, if it is determined that the condition forperforming the NSST is satisfied in the S610 (S620). More specifically,if it is determined that the condition for encoding the NSST index issatisfied, the encoding apparatus 100 may encode the NSST index.

The encoding apparatus 100 according to an exemplary embodiment may omitthe operation of the S620, if it is determined in the S610 that thecondition for performing the NSST is not satisfied.

The encoding apparatus 100 according to an exemplary embodiment may omitthe operations of the S610 and S620, if the flag representing whether atleast one non-zero transform coefficient exists among the transformcoefficients for the target block indicates 0 in the S600.

The encoding apparatus 100 according to an exemplary embodiment mayencode the information about the transform coefficients for the targetblock (S630). The encoding of the information about the transformcoefficients for the target block may include, for example, the encodingof the information about the location of the last non-zero transformcoefficient, the encoding of the group flag information of the subgroup,the encoding of the value of each of the transform coefficients includedin the subgroup, and the like, and is not limited thereto. A moredetailed description for the encoding of the information about thetransform coefficients for the target block will be described later withreference to FIGS. 7A, 8, and 9A.

FIG. 6B illustrates a decoding process of transform coefficientsaccording to an exemplary embodiment of the present disclosure.

The decoding apparatus 200 according to an exemplary embodiment maydetermine whether the flag representing whether at least one non-zerotransform coefficient exists among the transform coefficients for thetarget block indicates 1 (S640).

The decoding apparatus 200 according to an exemplary embodiment maydetermine whether the condition for performing the NSST is satisfied, ifthe flag representing whether at least one non-zero transformcoefficient exists among the transform coefficients for the target blockindicates 1 in the S640 (S650). More specifically, if the flagrepresenting whether at least one non-zero transform coefficient existsamong the transform coefficients for the target block indicates 1 in theS640, the decoding apparatus 200 may determine whether the condition fordecoding the NSST index is satisfied.

The decoding apparatus 200 according to an exemplary embodiment maydecode the NSST index, if it is determined that the condition forperforming the NSST is satisfied in the S650 (S660). More specifically,if it is determined that the condition for decoding the NSST index issatisfied, the decoding apparatus 200 may decode the NSST index.

In an exemplary embodiment, if the condition for decoding the NSST indexis satisfied (that is, if the NSST index may be used to code thetransform coefficients), the NSST index may be used to estimate theprobability of respective binarized bins of each syntax element to bedescribed later.

As an example, the information about the location of the last non-zerotransform coefficient may be encoded depending on the NSST index. Forexample, a binarization process of the last_sig_coeff_x field and thelast_sig_coeff_y field and a context model may depend on the NSST index.

As another example, a context model for a significance map may depend onthe NSST index. Here, the significance map may include information aboutvalid coefficients among the transform coefficients for the targetblock.

As still another example, a context model for a Greater_than_one map maydepend on the NSST index. Here, the Greater_than_one map may includeinformation about transform coefficients whose absolute value is greaterthan 1 among valid transform coefficients for the target block.

As yet another example, a context model for a Parity_map (orParity_flag) may depend on the NSST index. Here, the Parity_map mayinclude information about whether the corresponding transformcoefficient is an even number or an odd number with respect to a casewhere the absolute value is 2 or more among the valid transformcoefficients for the target block. For example, a case where theParity_flag is 0 may represent a case where the corresponding transformcoefficient is 2 or more and an even number, and a case where theParity_flag is 1 may represent a case where the corresponding transformcoefficient is 2 or more and an odd number. The parity_flag may existonly when the Greater_than_one flag is 1 with respect to thecorresponding transform coefficient.

As still yet another example, a context model for a Greater_than_two mapmay depend on the NSST index. Here, the Greater_than_two map may includeinformation about transform coefficients whose absolute value is 2 ormore among the valid transform coefficients for the target block. In afurther example, the update of a rice-parameter for transformcoefficient level coding may depend on the NSST index.

Meanwhile, the aforementioned last_sig_coeff_x, last_sig_coeff_y,Greater_than_one map (Greater_than_one_flag), Greater_than_two map(Greater_than_two_flag), rice-paramter, and the like are only oneexample of the syntax elements which may be signaled in the residualcoding process, and thus it will be easily understood by those skilledin the art that the names or definitions thereof may be changed slightlycase by case.

For example, the information about the last_sig_coeff_x may also bederived in consideration of both the information about thelast_sig_coeff_x_prefix and the information about thelast_sig_coeff_x_suffix, and the information about last_sig_coeff_y mayalso be derived in consideration of both the information about thelast_sig_coeff_y_prefix and the information about thelast_sig_coeff_y_suffix.

As another example, the Greater_than_one_map (flag), theGreater_than_two_map (flag), the rice-parameter, and the significancemap (flag) are syntax elements for classifying the absolute values ofthe transform coefficients based on integers 0, 1, 2, and the like, andthe names, definitions, signaling orders, signaling method thereof, andthe like may have a slight difference case by case. The significance map(flag) may be referred to as sig_coeff_flag. The Greater_than_one_flagmay be referred to as rem_abs_gt1_flag, and may represent whether theabsolute value of the transform coefficient is greater than 1 or 1 ormore. The Greater_than_two_flag may be referred to as rem_abs_gt2_flag,and may represent whether the absolute value of the transformcoefficient is greater than 2 or 2 or more. If the rem_abs_gt1_flagindicates 1, the rem_abs_gt2_flag may be signaled. If therem_abs_gt2_flag indicates 1, abs_remainder including information aboutthe remaining transform coefficients not derived may be signaled. Sincethe main purpose of the aforementioned syntax elements is to classifythe absolute values of the transform coefficients based on 0, 1, 2, andthe like, those skilled in the art will readily understand that thecorresponding relationship between the syntax elements such as theGreater_than_one_map (flag), the Greater_than_two_map (flag), therice-parameter, and the significance map (flag) and the syntax elementssuch as the rem_abs_gt1_flag, the rem_abs_gt2_flag, the abs_remainder,and the sig_coeff_flag may be different from those described above caseby case.

As still another example, the Parity_flag may be referred to aspar_level_flag. The par_level_flag may be signaled only when thesig_coeff_flag indicates 1 with respect to the corresponding transformcoefficient, and in some cases, may also be signaled only when therem_abs_gt1_flag indicates 1 with respect to the corresponding transformcoefficient.

The encoding apparatus 100 according to an exemplary embodiment may omitthe operation of the S660, if it is determined in the S650 that thecondition for performing the NSST is not satisfied.

The decoding apparatus 200 according to an exemplary embodiment may omitthe operations of the S650 and S660, if the flag representing whether atleast one non-zero transform coefficient exists among the transformcoefficients for the target block indicates 0 in the S640.

The decoding apparatus 200 according to an exemplary embodiment maydecode the information about the transform coefficients for the targetblock (S670). The decoding of the information about the transformcoefficients for the target block may include, for example, the decodingof the information about the location of the last non-zero transformcoefficient, the decoding of the group flag information of the subgroup,the decoding of the value of each of the transformation coefficientsincluded in the subgroup, and the like, but is not limited thereto. Amore detailed description of the decoding of the information about thetransform coefficients for the target block will be described later withreference to FIGS. 7B, 8, and 9B.

FIGS. 7A and 7B are flowcharts illustrating a coding process oftransform coefficients according to another exemplary embodiment of thepresent disclosure.

Each step illustrated in FIGS. 7A and 7B may be performed by theencoding apparatus 100 or the decoding apparatus 200 illustrated inFIGS. 1 and 2 , and more specifically, may be performed by the entropyencoder 130 illustrated in FIG. 1 and the entropy decoder 210illustrated in FIG. 2 . In addition, S700 of FIG. 7A may correspond tothe S430 of FIG. 4A, and S740 of FIG. 7B may correspond to the S470 ofFIG. 4B. Accordingly, detailed descriptions overlapping with thecontents described above with reference to FIGS. 1, 2, 4A, and 4B willbe omitted or simplified.

FIG. 7A illustrates an encoding process of transform coefficientsaccording to another exemplary embodiment of the present disclosure.

The encoding apparatus 100 according to an exemplary embodiment mayencode the NSST index (S700).

The encoding apparatus 100 according to an exemplary embodiment maydetermine whether the NSST index is greater than 0 (S710).

The encoding apparatus 100 according to an exemplary embodiment mayencode the information about the location of the last non-zero transformcoefficient among the transform coefficients for the target block, ifthe NSST index is not greater than 0 in the S710 (S720). Morespecifically, if a total of A transform coefficients for the targetblock exist, the encoding apparatus 100 may encode the information aboutthe location of the last non-zero transform coefficient based on aspecific scanning order among the transform coefficients in a range offirst to A^(th) transform coefficients which are all of the transformcoefficients for the target block.

The encoding apparatus 100 according to an exemplary embodiment mayencode the information about the location of the last non-zero transformcoefficient among the transform coefficients other than the transformcoefficients for the target block in a range of R+1^(th) to N^(th)transform coefficients, if the NSST index is greater than 0 in the S710(S730).

The primary transform and the secondary transform described above withreference to FIGS. 1 to 3 may be applied based on a reduced transform.Since the NSST described with reference to FIGS. 4A to 11 is an exampleof the secondary transform, the NSST may also be applied based on thereduced transform. The reduced transform means a transform whichdecreases the amount of computation required during transform bydecreasing the size of the transform matrix based on the reducedcoefficient (R) when performing the transform. At this time, the reducedcoefficient (R) may be signaled by being included in the informationabout the transform coefficient for the target block, or determined as aspecific coefficient based on the size of the target block, and theexemplary embodiment is not limited thereto. The reduced transform maybe variously referred to as reduced transform, reduced transform, RTS,and the like.

Generally, when the NSST is performed, the size of the transform matrix(or the matrix) used during the transform may be N×N if the square ofthe length of one side of the block to which the NSST is applied is N.In comparison therewith, if the NSST is applied based on the reducedtransform, the size of the reduced transform matrix may be R×N (whereR<N). When the reduced transform is applied, the size of the transformmatrix may be decreased by an R/N ratio which is a reduced factor,thereby enhancing the transform efficiency and coding efficiency of theencoding apparatus 100.

Since R transform coefficients are derived when the NSST is appliedbased on the reduced transform, the number of transform coefficients maybe decreased by N−R compared to the case where the N transformcoefficients are derived when the NSST is applied not based on thereduced transform. At this time, the encoding apparatus 100 may regardas 0 the transform coefficients for the target block in a range ofR+1^(th) to N^(th) transform coefficients which are not derived when theNSST is applied based on the reduced transformation, and accordingly,the encoding apparatus 100 may derive the last non-zero transformcoefficient among the transform coefficients other than the transformcoefficients for the target block in the range of the R+1^(th) to N^(th)transform coefficients in the S730.

FIG. 7B illustrates a decoding process of transform coefficientsaccording to another exemplary embodiment of the present disclosure.

The decoding apparatus 200 according to an exemplary embodiment maydecode the NSST index (S740).

The decoding apparatus 200 according to an exemplary embodiment maydetermine whether the NSST index is greater than 0 (S750).

The decoding apparatus 200 according to an exemplary embodiment maydecode the information about the location of the last non-zero transformcoefficient among the transform coefficients for the target block, ifthe NSST index is not greater than 0 in the S750 (S760). Morespecifically, if a total of A transform coefficients for the targetblock exist, the decoding apparatus 200 may decode the information aboutthe location of the last non-zero transform coefficient based on thespecific scanning order among the transform coefficients in the range offirst to A^(th) transform coefficients which are all of the transformcoefficients for the target block.

The decoding apparatus 200 according to an exemplary embodiment maydecode the information about the location of the last non-zero transformcoefficient among the transform coefficients other than the transformcoefficients for the target block in the range of the R+1^(th) to N^(th)transform coefficients, if the NSST index is greater than 0 in the S750(S770).

The primary inverse transform and the secondary inverse transformdescribed above with reference to FIGS. 1 to 3 may be applied based on areduced inverse transform. Since the inverse NSST described withreference to FIGS. 4A to 11 is an example of the secondary inversetransform, the inverse NSST may also be applied based on the reducedinverse transform. The reduced inverse transform is an inverse transformof the reduced transform described above with reference to FIG. 7A, anda reduced inverse transform matrix may have a transpose relationshipwith the reduced transform matrix. The reduced inverse transform may bevariously referred to as reduced inverse transform, reduced inversetransform, inverse RTS, and the like.

Since the reduced inverse transform matrix has the transposerelationship with the reduced transform matrix, the matrix size may beN×R (where R<N). When the reduced inverse transform is applied, the sizeof the transform matrix is decreased by the R/N ratio which is thereduced factor, thereby enhancing the transform efficiency and codingefficiency of the decoding apparatus 200.

Since R transform coefficients are required when the inverse NSST isapplied based on the reduced inverse transform, the required number oftransform coefficients may be decreased by N−R compared to the casewhere the N transform coefficients are required when the inverse NSST isapplied not based on the reduced inverse transform. At this time, thedecoding apparatus 200 may regard as 0 the transform coefficients forthe target block in the range of the R+1^(th) to N^(th) transformcoefficients which are not required when the inverse NSST is appliedbased on the reduced inverse transform, and accordingly, the decodingapparatus 200 may derive the last non-zero transform coefficient amongthe transform coefficients other than the transform coefficients for thetarget block in the range of the R+1^(th) to N^(th) transformcoefficients in the S770.

FIGS. 8A and 8B are flowcharts illustrating a coding process oftransform coefficients according to still another exemplary embodimentof the present disclosure.

Each step illustrated in FIGS. 8A and 8B may be performed by theencoding apparatus 100 or the decoding apparatus 200 illustrated inFIGS. 1 and 2 , and more specifically, may be performed by the entropyencoder 130 illustrated in FIG. 1 and the entropy decoder 210illustrated in FIG. 2 . Accordingly, detailed descriptions overlappingwith the contents described above with reference to FIG. 1 or 2 will beomitted or simplified.

FIG. 8A illustrates an encoding process of transform coefficientsaccording to still another exemplary embodiment.

The encoding apparatus 100 according to an exemplary embodiment maydetermine whether it is necessary to encode the group flag informationof the subgroup according to the group condition (S800). The encodingapparatus 100 may determine that it is necessary to encode the groupflag information of the subgroup other than the first subgroup (thesubgroup index 0) and the last subgroup (the subgroup index n−1, where nis the total number of subgroups of the target block) for the targetblock based on the group condition. Since the group flags of the firstsubgroup and the last subgroup for the target block are determined as 1,the encoding apparatus 100 may determine that the group flag informationof the first subgroup and the last subgroup need not be encodedaccording to the group condition.

The encoding apparatus 100 according to an exemplary embodiment maydetermine whether the subgroup is a subgroup other than the subgroupincluding only the transform coefficients in the range of the R+1^(th)to N^(th) transform coefficients, if it is determined that it isnecessary to encode the group flag information of the subgroup accordingto the group condition in the S800 (S810). At this time, the NSST indexmay be greater than 0, and the transform coefficients in the range ofthe R+1^(th) to N^(th) transform coefficients for the target block areeach determined as 0 if the NSST index is greater than 0, such that thegroup flag of the subgroup including only the transform coefficients inthe range of the R+1^(th) to N^(th) transform coefficients for thetarget block may be determined as 0, and the encoding apparatus 100 maydetermine that it is not necessary to encode the group flag of thesubgroup including only the transform coefficients in the range of theR+1^(th) to N^(th) transform coefficients in the S810.

The encoding apparatus 100 according to an exemplary embodiment mayencode the group flag of the subgroup, if it is determined in the S810that the subgroup is a subgroup other than the subgroup including onlythe transform coefficients in the range of the R+1^(th) to N^(th)transform coefficients (S820).

The encoding apparatus 100 according to an exemplary embodiment may omitthe operations of the S810 and the S820, if it is determined in the S800that it is not necessary to encode the group flag of the subgroupaccording to the group condition. More specifically, if the currentsubgroup is the first subgroup or the last subgroup, the encodingapparatus 100 may determine that it is not necessary to encode the groupflag of the subgroup, and accordingly omit the operations of the S810and the S820.

The encoding apparatus 100 according to an exemplary embodiment maydetermine whether the group flag of the subgroup indicates 1 (S830).

The encoding apparatus 100 according to an exemplary embodiment mayencode a value (or level) of each of the transform coefficients includedin the subgroup, if the group flag of the subgroup indicates 1 in theS830 (S840).

The encoding apparatus 100 according to an exemplary embodiment may omitthe operation of the S840, if the group flag of the subgroup indicates 0in the S830. More specifically, if the group flag of the subgroupindicates 0, the encoding apparatus 100 may determine the transformcoefficients included in the subgroup as 0, respectively, andaccordingly, omit the encoding for the value (or level) of each of thetransform coefficients included in the subgroup.

The encoding apparatus 100 according to an exemplary embodiment may omitthe operations of the S820, the S830, and the S840, if it is determinedin the S810 that the subgroup is a subgroup including only the transformcoefficients in the range of the R+1^(th) to N^(th) transformcoefficients. More specifically, if the subgroup is a subgroup includingonly the transform coefficients in the range of the R+1^(th) to N^(th)transform coefficients, the encoding apparatus 100 may determine that itis not necessary to encode the group flag of the subgroup, andaccordingly, omit the operations of the S820, the S830, and the S840.

When considering the S800 and the S810, the group flag informationcorresponding to the subgroup other than the first subgroup, the lastsubgroup, and the subgroup including only the transform coefficients forthe target block in the range of the R+1^(th) to N^(th) transformcoefficients among at least one subgroup for the target block may beencoded.

FIG. 8B illustrates a decoding process of transform coefficientsaccording to still another exemplary embodiment.

The decoding apparatus 200 according to an exemplary embodiment maydetermine whether it is necessary to decode the group flag of thesubgroup according to the group condition (S850). The decoding apparatus200 may determine that it is necessary to decode the group flaginformation of the subgroup other than the first subgroup (the subgroupindex 0) and the last subgroup (the subgroup index n−1, where n is thetotal number of subgroups of the target block) for the target blockbased on the group condition. Since the group flags of the firstsubgroup and the last subgroup for the target block are determined as 1,the decoding apparatus 200 may determine that it is not necessary todecode the group flag information of the first subgroup and the lastsubgroup according to the group condition.

The decoding apparatus 200 according to an exemplary embodiment maydetermine whether the subgroup is a subgroup other than the subgroupincluding only the transform coefficients in the range of the R+1^(th)to N^(th) transform coefficients, if it is determined that it isnecessary to decode (or parse) the group flag of the subgroup (from abitstream) according to the group condition in the S850 (S860). At thistime, the NSST index may be greater than 0, and the transformcoefficients in the range of the R+1^(th) to N^(th) transformcoefficients for the target block are determined as 0, respectively ifthe NSST index is greater than 0, such that the group flag of thesubgroup including only the transform coefficients in the range of theR+1^(th) to N^(th) transform coefficients for the target block may bedetermined as 0, and the decoding apparatus 200 may determine that it isnot necessary to decode (or parse) the group flag of the subgroupincluding only the transform coefficients in the range of the R+1^(th)to N^(th) transform coefficients (from the bitstream) in the S860.

The decoding apparatus 200 according to an exemplary embodiment maydecode (or parse) the group flag of the subgroup (from the bitstream),if it is determined that the subgroup is a subgroup other than thesubgroup including only the transform coefficients in the range of theR+1^(th) to N^(th) transform coefficients in the S860 (S870).

The decoding apparatus 200 according to an exemplary embodiment may omitthe operations of the S860 and the S870, if it is determined in the S850that it is not necessary to decode the group flag of the subgroupaccording to the group condition. More specifically, if the currentsubgroup is the first subgroup or the last subgroup, the decodingapparatus 200 may determine that it is not necessary to decode the groupflag of the subgroup, and accordingly, omit the operations of the S860and the S870.

The decoding apparatus 200 according to an exemplary embodiment maydetermine whether the group flag of the subgroup indicates 1 (S880).

The decoding apparatus 200 according to an exemplary embodiment maydecode the value (or level) of each of the transform coefficientsincluded in the subgroup, if the group flag of the subgroup indicates 1in the S880 (S890).

The decoding apparatus 200 according to an exemplary embodiment may omitthe operation of the S890, if the group flag of the subgroup indicates 0in the S880. More specifically, if the group flag of the subgroupindicates 0, the decoding apparatus 200 may determine the transformcoefficients included in the subgroup as 0, respectively, andaccordingly, omit the decoding for the value (or level) of each of thetransform coefficients included in the subgroup.

The decoding apparatus 200 according to an exemplary embodiment may omitthe operations of the S870, the S880, and the S890, if it is determinedin the S860 that the subgroup is a subgroup including only the transformcoefficients in the range of the R+1^(th) to N^(th) transformcoefficients. More specifically, if the subgroup is a subgroup includingonly the transform coefficients in the range of the R+1^(th) to N^(th)transform coefficients, the decoding apparatus 200 may determine that itis not necessary to decode the group flag of the subgroup, andaccordingly, omit the operations of the S870, the S880, and the S890.

FIG. 9 is a diagram for explaining an arrangement of transformcoefficients based on a target block according to an exemplaryembodiment of the present disclosure. Hereinafter, descriptions abouttransform described below with reference to FIG. 9 may also be appliedto the inverse transform in the same manner.

For the target block (or the residual block) 900, the primary transformand the NSST (an example of the secondary transform) may be performed.At this time, a first exemplary embodiment may perform the NSST based onthe reduced transform, and a second exemplary embodiment may alsoperform the NSST not based on the reduced transform.

In the first exemplary embodiment, the NSST not based on the reducedtransform in addition to the primary transform may be performed for thetarget block 900. As an example, a 16×16 block illustrated in FIG. 9represents the target block 900, and 4×4 blocks indicated by A to P mayrepresent subgroups of the target block 900. The primary transform maybe performed in the entire range of the target block 900, and after theprimary transform is performed, the NSST may be applied to 8×8 blocksconfigured by subgroups A, B, E, and F. If the primary transform and theNSST are performed sequentially, the N (where N means the square of thelength of one side of the block to which the NSST is applied, and thusmay become 64 which is the square of 8 in the present example) NSSTtransform coefficients derived by performing the NSST may be assigned tothe respective blocks included in the subgroups A, B, E, and F, and theprimary transform coefficients for which the NSST is not performed maybe assigned to the respective blocks included in subgroups C, D, G, H,I, J, K, L, M, N, O and P.

In the second exemplary embodiment, the NSST based on the reducedtransform in addition to the primary transform may be performed for thetarget block 900. As an example, the 16×16 block illustrated in FIG. 9represents the target block 900, and the 4×4 blocks indicated by A to Pmay represent the subgroups of the target block 900. The primarytransform may be performed in the entire range of the target block 900,and after the primary transform is performed, the NSST may be applied to8×8 blocks configured by the subgroups A, B, E, and F. At this time, ifthe NSST based on the reduced transform is performed, only R (where Rmeans a reduced coefficient, and R is smaller than N) NSST transformcoefficients are derived, such that the NSST transform coefficients inthe range of the R+1^(th) to N^(th) transform coefficients may be eachdetermined as 0. If R is, for example, 16, the 16 transform coefficientsderived by performing the NSST based on the reduced transform may beassigned to the respective blocks included in the subgroup A, which isthe top-left 4×4 block of the target block 900, and the transformcoefficient 0 may be assigned to N−R respective blocks, that is,64−16=48, included in the subgroups B, E, and F. The primary transformcoefficients for which the NSST based on the reduced transform is notperformed may be assigned to the respective blocks included in thesubgroups C, D, G, H, I, J, K, L, M, N, O, and P.

In the aforementioned second exemplary embodiment, since the R+1^(th) toN^(th) NSST transform coefficients of the target block 900 are eachdetermined as 0, the last non-zero transform coefficient of the targetblock 900 may be derived among the transform coefficients other than theR+1^(th) to N^(th) transform coefficients. That is, since the R+1^(th)(that is, 17^(th)) to N^(th) (that is, 64^(th)) transform coefficientsin the target block 900 of FIG. 9 are each 0, and may be assigned to thesubgroups B, E, and F, the last non-zero transform coefficient may bederived within the range of the subgroups A, C, D, G, H, I, J, K, L, M,N, O, and P other than the subgroups B, E, and F. The subgroups B, E,and F may be excluded in the process of deriving and coding the lastnon-zero transform coefficient, thereby enhancing computation and codingefficiency.

In addition, when the subgroups B, E, and F are excluded from thedetermination range in the process of deriving the last non-zerotransform coefficient according to the aforementioned second exemplaryembodiment, the location of the last non-zero transform coefficient maybe derived more efficiently. For example, when the coordinates of thetransform coefficient located at the top-left of the target block 900are (0, 0), the coordinates of the transform coefficient located at thetop-left of the subgroup J are (4, 8). When the non-zero transformcoefficient is located at the top-left of the subgroup J, according tothe second exemplary embodiment, it may be considered that the transformcoefficients included in the subgroups B, E, and F are excluded from thedetermination range, and the subgroup J is located in an area where oneof the subgroups B, E, and F is located, such that the coordinates ofthe non-zero transform coefficient may be regarded as one of (4, 0), (0,4), and (4, 4). Accordingly, if the transform coefficients included inthe subgroups B, E, and F are excluded from the determination range, avalue of at least one of the x coordinate and the y coordinate of thelast non-zero transform coefficient may be decreased, when compared to(4, 8) which are the coordinates of the last non-zero transformcoefficient before exclusion. If the value of one of the x coordinateand the y coordinate of the last non-zero transform coefficientdecreases from 8 to 4, for example, the required binary code may bedecreased from 3 bits to 2 bits, and the coding efficiency may also beenhanced by decreasing the number of bits in the binary code. Meanwhile,the aforementioned example is for convenience of description, andaccording to the second exemplary embodiment, the location of the lastnon-zero transform coefficient may be efficiently derived in varioussimilar methods other than the aforementioned examples.

In addition, the aforementioned second exemplary embodiment may omit theencoding or the decoding of the group flag information corresponding tothe subgroups B, E, and F. This is because the transform coefficientsassigned to the subgroups B, E, and F are all 0, and thus it is obviousthat the group flag will indicate 0. This corresponds to the case wherethe group flag of the subgroup is not encoded or decoded, if it isdetermined that the subgroup in the S810 of FIG. 8A and the S860 of FIG.8B described above is a subgroup including only the transformcoefficients in the range of the R+1^(th) to N^(th) transformcoefficients.

Meanwhile, the first exemplary embodiment and the second exemplaryembodiment described above are divided merely for convenience ofdescription, and the scope of the present disclosure should not beinterpreted as being limited to the first exemplary embodiment and thesecond exemplary embodiment. It should be interpreted that the exemplaryembodiments which are apparently derived from the first exemplaryembodiment and the second exemplary embodiment and exemplary embodimentssimilar to the first exemplary embodiment and the second exemplaryembodiment also fall within the scope of the present disclosure. Inaddition, the specific examples described above in connection with eachof the first exemplary embodiment and the second exemplary embodimentare also for explaining the present disclosure, and the first exemplaryembodiment and the second exemplary embodiment should not be interpretedas being limited to the aforementioned specific examples. It should beinterpreted that examples obviously derived from the aforementionedspecific examples and examples similar to the aforementioned specificexamples fall within the scope of the first exemplary embodiment and thesecond exemplary embodiment.

FIG. 10 is a flowchart illustrating an operation of a video encodingapparatus according to an exemplary embodiment of the presentdisclosure.

Each step illustrated in FIG. 10 may be performed by the encodingapparatus 100 illustrated in FIG. 1 . More specifically, S1000 and S1020may be performed by the entropy encoder 130 illustrated in FIG. 1 , andS1010 may be performed by the transformer 122 illustrated in FIG. 1 . Inaddition, the operations of the S1000 to the S1020 are based on some ofthe contents described above with reference to FIGS. 4A to 9 .Accordingly, detailed descriptions overlapping with the contentsdescribed above with reference to FIGS. 1, and 4A to 9 will be omittedor simplified.

The encoding apparatus 100 according to an exemplary embodiment maygenerate and encode the NSST index, if the NSST is applied to the targetblock (S1000). More specifically, the entropy encoder 130 may determinewhether the condition for performing the NSST for the target block issatisfied, and if the condition for performing the NSST is satisfied andthus the NSST is applied to the target block, the NSST index may begenerated and encoded.

The encoding apparatus 100 according to an exemplary embodiment maytransform coefficients for the target block (S1010). More specifically,the transformer 122 may transform the coefficients for the target block.The transformer 122 may first apply the primary transform to thecoefficients for the target block, and then apply the NSST to the blockto which the NSST is applied among the target blocks. When the primarytransform and the NSST are applied to the coefficients for the targetblock, the transform coefficients for the target block may be derived.

At this time, the NSST may be applied, based on the reduced transform,to the block to which the NSST is applied among the target blocks. Ifthe NSST is applied based on the reduced transform and the NSST index isgreater than 0, the R+1^(th) (where R means the reduced coefficient ofthe reduced transform) to N^(th) transform coefficients (where N meansthe square of the length of one side of the block to which the NSST isapplied) for the target block may be determined as zero.

The encoding apparatus 100 according to an exemplary embodiment maygenerate and encode the information about the transform coefficients forthe target block based on the NSST index (S1020). If the NSST is appliedbased on the reduced transform and the NSST index is greater than 0, theentropy encoder 130 may generate and encode the information about thetransform coefficients for the target block considering that theR+1^(th) to N^(th) transform coefficients for the target block are 0.

Referring to the S1000 and the S1020, it may be confirmed that the NSSTindex is encoded prior to the information about the transformcoefficients for the target block. The NSST index may be generated andencoded prior to the information about the transform coefficients forthe target block, thereby enhancing accuracy and efficiency of thecoding process for estimating residual data.

The information about the transform coefficients for the target blockmay include, for example, at least one of information about the locationof the last non-zero transform coefficient, group flag informationindicating whether the non-zero transform coefficient is included in thesubgroup of the target block, and information about the reducedcoefficient (R).

As an example, if the NSST is applied based on the reduced transform andthe NSST index is greater than 0, the entropy encoder 130 of theencoding apparatus 100 may derive the non-zero transform coefficientamong the transform coefficients other than the R+1^(th) to N^(th)transform coefficients considering that the R+1^(th) to N^(th) transformcoefficients for the target block are 0. Accordingly, the computationalefficiency of the encoding apparatus 100 may be enhanced. In addition,by encoding the non-zero transform coefficient among the transformcoefficients other than the R+1^(th) to N^(th) transform coefficients,as described above with reference to FIG. 9 , it is possible to decreasethe number of bits, thereby enhancing the coding efficiency of theencoding apparatus 100.

As another example, if the NSST is applied based on the reducedtransform and the NSST index is greater than 0, the entropy encoder 130of the encoding apparatus 100 may omit the encoding for the group flaginformation corresponding to the subgroup including only the transformcoefficients in the range of the R+1^(th) to N^(th) transformcoefficients considering that the R+1^(th) to N^(th) transformcoefficients for the target block are 0. Accordingly, the codingefficiency of the encoding apparatus 100 may be enhanced.

FIG. 11 is a flowchart illustrating an operation of a video decodingapparatus according to an exemplary embodiment of the presentdisclosure.

Each step illustrated in FIG. 11 may be performed by the decodingapparatus 200 illustrated in FIG. 2 . More specifically, the S1100 tothe S1120 may be performed by the entropy decoder 130 illustrated inFIG. 2 . In addition, the operations of the S1100 to the S1120 are basedon some of the contents described above with reference to FIGS. 4A to 9. Accordingly, detailed descriptions overlapping with the contentsdescribed above with reference to FIGS. 2 and 4A to 9 will be omitted orsimplified.

The decoding apparatus 200 according to an exemplary embodiment maydecode the NSST index from a bitstream, if the NSST is applied to thetarget block (S1100). More specifically, the entropy decoder 210 maydetermine whether the condition for performing the NSST for the targetblock is satisfied, and decode the NSST index from the bitstream, if thecondition for performing the NSST is satisfied and thus the NSST isapplied to the target block.

The decoding apparatus 200 according to an exemplary embodiment maydecode the information about the transform coefficients for the targetblock from the bitstream based on the decoded NSST index (S1110). Atthis time, the NSST may be applied, based on the reduced transform, tothe block to which the NSST is applied among the target blocks in theencoding apparatus 100. If the NSST is applied based on the reducedtransform in the encoding apparatus 100 and the NSST index is greaterthan 0, the R+1^(th) to N^(th) transform coefficients for the targetblock may be determined as 0. Referring to the S1100 and the S1110, itmay be confirmed that the NSST index is decoded prior to the informationabout the transform coefficients for the target block. The NSST indexmay be decoded prior to the information about the transform coefficientsfor the target block, thereby enhancing accuracy and efficiency of thecoding process for estimating residual data.

If the NSST is applied based on the reduced transform in the encodingapparatus 100 and the NSST index is greater than 0, the entropy decoder210 may decode the information about the transform coefficients for thetarget block from the bitstream considering that the R+1^(th) to N^(th)transform coefficients for the target block are 0.

The information about the transform coefficients for the target blockmay include, for example, at least one of the information about thelocation of the last non-zero transform coefficient, the group flaginformation indicating whether the non-zero transform coefficient isincluded in the subgroup of the target block, and the information aboutthe reduced coefficient (R).

As an example, if the NSST is applied based on the reduced transform andthe NSST index is greater than 0, the entropy decoder 210 of thedecoding apparatus 200 may decode the non-zero transform coefficientamong the transform coefficients other than the R+1^(th) to N^(th)transform coefficients, thereby enhancing the coding efficiency of thedecoding apparatus 200 by decreasing the number of bits, as illustratedin FIG. 9 .

As another example, if the NSST is applied based on the reducedtransform and the NSST index is greater than 0, the entropy decoder 210of the decoding apparatus 200 may omit the decoding for the group flaginformation corresponding to the subgroup including only the transformcoefficients in the range of the R+1^(th) to N^(th) transformcoefficients considering that the R+1^(th) to N^(th) transformcoefficients for the target block are 0. As a result, the codingefficiency of the decoding apparatus 200 may be enhanced.

The decoding apparatus 200 according to an exemplary embodiment maygenerate (or derive) the transform coefficients for the target blockbased on the information about the decoded transform coefficients(S1120). For example, the entropy decoder 210 may generate (derive) thetransform coefficients for the target block based on at least one of theinformation about the location of the last non-zero transformcoefficient, the group flag information indicating whether the non-zerotransform coefficient is included in the subgroup of the target block,and the information about the reduced coefficient (R).

The inverse transformer 223 according to an exemplary embodiment mayderive coefficients (or residual samples) for the target block byinversely transforming the transform coefficients for the target blockbased on the NSST index.

The adder (or reconstructor) 240 according to an exemplary embodimentmay generate the reconstructed picture based on the coefficients (or theresidual samples) for the target block obtained from the inversetransformer 223 and the prediction samples for the target block obtainedfrom the predictor 230.

The aforementioned method according to the present disclosure may beimplemented in a software form, and the encoding apparatus and/or thedecoding apparatus according to the present disclosure may be includedin an apparatus for performing the image processing such as a TV, acomputer, a smart phone, a set-top box, or a display device.

When the exemplary embodiments of the present disclosure are implementedin software, the aforementioned method may be implemented by modules(processes, functions, and so on) that perform the functions describedabove. Such modules may be stored in memory and executed by a processor.The memory may be internal or external to the processor, and the memorymay be coupled to the processor using various well known means. Theprocessor may comprise an application-specific integrated circuit(ASIC), other chipsets, a logic circuit and/or a data processing device.The memory may include a read-only memory (ROM), a random access memory(RAM), a flash memory, a memory card, a storage medium, and/or otherstorage device.

What is claimed is:
 1. An image decoding method performed by a decodingapparatus, the decoding method comprising: decoding a secondarytransform index from a bitstream; decoding information about transformcoefficients for a target block from the bitstream; generating thetransform coefficients for the target block based on the decodedinformation about the transform coefficients; deriving modifiedtransform coefficients for the target block based on a secondary inversetransform using the transform coefficients and the secondary transformindex; deriving residual samples for the target block based on aninverse transform using the modified transform coefficients; andgenerating reconstructed samples based on the residual samples, whereinbased on a case that the secondary transform index is greater than 0,the secondary inverse transform is applied to the transform coefficientsin an input target region included in the target block, wherein based ona case that the secondary inverse transform is applied, the transformcoefficients for the target block in a range of an R+1^(th) to N^(th)transform coefficients are equal to 0, wherein the secondary inversetransform is performed based on a reduced inverse transform, wherein thereduced inverse transform is performed based on a transform matrix ofwhich size is R×N, the R is equal to a number of transform coefficientsin the input target region to which the reduced inverse transform isapplied, the N is equal to a number of the modified transformcoefficients in an output target region, and the R is smaller than theN, wherein the information about the transform coefficients for thetarget block includes information about a location of a last non-zerotransform coefficient, and wherein based on the case that the secondarytransform index is greater than 0, the last non-zero transformcoefficient is one of transform coefficients other than the transformcoefficients for the target block in the range of the R+1^(th) to N^(th)transform coefficients.
 2. The image decoding method of claim 1, whereinthe information about the transform coefficients for the target blockincludes: at least one of group flag information indicating whether anon-zero transform coefficient is included in a subgroup of the targetblock, and information about the R.
 3. The image decoding method ofclaim 2, wherein the group flag information corresponding to thesubgroup of the target block comprising only the transform coefficientsfor the target block in the range of the R+1^(th) to N^(th) transformcoefficients is not decoded from the bitstream.
 4. The image decodingmethod of claim 2, wherein the group flag information corresponding to asubgroup other than a first subgroup, a last subgroup, and the subgroupcomprising only the transform coefficients for the target block in therange of the R+1^(th) to N^(th) transform coefficients among at leastone subgroup of the target block is decoded from the bitstream.
 5. Theimage decoding method of claim 4, wherein based on a case that the groupflag information decoded from the bitstream indicates 0, all transformcoefficients included in the subblock corresponding to the group flaginformation indicating 0 are each determined as
 0. 6. The image decodingmethod of claim 4, wherein based on a case that the group flaginformation decoded from the bitstream indicates 1, a value of each ofthe transform coefficients included in the subblock corresponding to thegroup flag information indicating 1 is decoded.
 7. The image decodingmethod of claim 1, wherein the secondary transform index is decodedprior to the information about the transform coefficients for the targetblock, and wherein the location of the last non-zero transformcoefficient is determined based on the secondary transform index.
 8. Theimage decoding method of claim 7, wherein based on the secondarytransform index being greater than 0 and the last non-zero transformcoefficient is a subsequent transform coefficient to the Nth transformcoefficient, location information indicating one of locations of theR+1th to Nth transform coefficients are used as the information aboutthe location of the last non-zero transform coefficient which is thesubsequent transform coefficient to the Nth transform coefficient. 9.The image decoding method of claim 8, wherein the location informationincludes x coordinate information and y coordinate information, whereinbased on the location information indicating one of locations of theR+1th to Nth transform coefficients, an x coordinate of the lastnon-zero transform coefficient which is the subsequent transformcoefficient to the Nth transform coefficient is modified as a value ofthe x coordinate information plus 4 or a y coordinate of the lastnon-zero transform coefficient which is the subsequent transformcoefficient to the Nth transform coefficient is modified as a value ofthe y coordinate information plus
 4. 10. An image encoding methodperformed by an encoding apparatus, the encoding method comprising:deriving residual samples for a target block; generating a secondarytransform index; generating modified transform coefficients for thetarget block based on a transform using the residual samples; generatingtransform coefficients for the target block based on a secondarytransform using the secondary transform index and the modified transformcoefficients for the target block; generating information about thetransform coefficients for the target block; and encoding theinformation about the transform coefficients and the secondary transformindex, wherein based on a case that the secondary transform index isgreater than 0, the secondary transform is applied to the modifiedtransform coefficients in an input target region included in the targetblock, wherein based on a case that the secondary transform is applied,the transform coefficients for the target block in a range of anR+1^(th) to N^(th) transform coefficients are equal to 0, wherein thesecondary transform is performed based on a reduced transform, whereinthe reduced transform is performed based on a transform matrix of whichsize is R×N, the N is equal to a number of modified transformcoefficients in the input target region to which the reduced transformis applied, the R is equal to a number of the transform coefficients inan output target region, and the R is smaller than the N, wherein theinformation about the transform coefficients for the target blockincludes information about a location of a last non-zero transformcoefficient, and wherein based on the case that the secondary transformindex is greater than 0, the last non-zero transform coefficient is oneof transform coefficients other than the transform coefficients for thetarget block in the range of the R+1^(th) to N^(th) transformcoefficients.
 11. The image encoding method of claim 10, wherein theinformation about the transform coefficients for the target blockincludes: at least one of group flag information indicating whether anon-zero transform coefficient is included in a subgroup of the targetblock, and information about the R.
 12. The image encoding method ofclaim 11, wherein the group flag information corresponding to thesubgroup of the target block comprising only the transform coefficientsfor the target block in the range of the R+1^(th) to N^(th) transformcoefficients is not encoded.
 13. The image encoding method of claim 10,wherein the secondary transform index is encoded prior to theinformation about the transform coefficients for the target block, andwherein the location of the last non-zero transform coefficient isdetermined based on the secondary transform index.
 14. The imageencoding method of claim 13, wherein based on the secondary transformindex being greater than 0 and the last non-zero transform coefficientis a subsequent transform coefficient to the Nth transform coefficient,location information indicating one of locations of the R+1th to Nthtransform coefficients are used as the information about the location ofthe last non-zero transform coefficient which is the subsequenttransform coefficient to the Nth transform coefficient.
 15. The imageencoding method of claim 14, wherein the location information includes xcoordinate information and y coordinate information, wherein based onthe location information indicating one of locations of the R+1th to Nthtransform coefficients, an x coordinate of the last non-zero transformcoefficient which is the subsequent transform coefficient to the Nthtransform coefficient is modified as a value of the x coordinateinformation plus 4 or a y coordinate of the last non-zero transformcoefficient which is the subsequent transform coefficient to the Nthtransform coefficient is modified as a value of the y coordinateinformation plus
 4. 16. A non-transitory computer-readable storagemedium storing a bitstream generated by a method, the method comprising:deriving residual samples for a target block; generating a secondarytransform index; generating modified transform coefficients for thetarget block based on a transform using the residual samples; generatingtransform coefficients for the target block based on a secondarytransform using the secondary transform index and the modified transformcoefficients for the target block; generating information about thetransform coefficients for the target block; and encoding theinformation about the transform coefficients and the secondary transformindex to generate the bitstream, wherein based on a case that thesecondary transform index is greater than 0, the secondary transform isapplied to the modified transform coefficients in an input target regionincluded in the target block, wherein based on a case that the secondarytransform is applied, the transform coefficients for the target block ina range of an R+1^(th) to N^(th) transform coefficients are equal to 0,wherein the secondary transform is performed based on a reducedtransform, wherein the reduced transform is performed based on atransform matrix of which size is R×N, the N is equal to a number ofmodified transform coefficients in the input target region to which thereduced transform is applied, the R is equal to a number of thetransform coefficients in an output target region, and the R is smallerthan the N, wherein the information about the transform coefficients forthe target block includes information about a location of a lastnon-zero transform coefficient, and wherein based on the case that thesecondary transform index is greater than 0, the last non-zero transformcoefficient is one of transform coefficients other than the transformcoefficients for the target block in the range of the R+1^(th) to N^(th)transform coefficients.
 17. The non-transitory computer-readable storagemedium of claim 16, wherein the secondary transform index is decodedprior to the information about the transform coefficients for the targetblock, and wherein the location of the last non-zero transformcoefficient is determined based on the secondary transform index. 18.The non-transitory computer-readable storage medium of claim 17, whereinbased on the secondary transform index being greater than 0 and the lastnon-zero transform coefficient is a subsequent transform coefficient tothe Nth transform coefficient, location information indicating one oflocations of the R+1th to Nth transform coefficients are used as theinformation about the location of the last non-zero transformcoefficient which is the subsequent transform coefficient to the Nthtransform coefficient.
 19. The non-transitory computer-readable storagemedium of claim 18, wherein the location information includes xcoordinate information and y coordinate information, wherein based onthe location information indicating one of locations of the R+1^(th) toNth transform coefficients, an x coordinate of the last non-zerotransform coefficient which is the subsequent transform coefficient tothe Nth transform coefficient is modified as a value of the x coordinateinformation plus 4 or a y coordinate of the last non-zero transformcoefficient which is the subsequent transform coefficient to the Nthtransform coefficient is modified as a value of the y coordinateinformation plus
 4. 20. A transmission method of data for image, thetransmission method comprising: obtaining bitstream generated byperforming deriving residual samples for a target block, generating asecondary transform index, generating modified transform coefficientsfor the target block based on a transform using the residual samples,generating transform coefficients for the target block based on asecondary transform using the secondary transform index and the modifiedtransform coefficients for the target block, generating informationabout the transform coefficients for the target block and encoding theinformation about the transform coefficients and the secondary transformindex to generate the bitstream; and transmitting the data comprisingthe bitstream, wherein based on a case that the secondary transformindex is greater than 0, the secondary transform is applied to themodified transform coefficients in an input target region included inthe target block, wherein based on a case that the secondary transformis applied, the transform coefficients for the target block in a rangeof an R+1^(th) to N^(th) transform coefficients are equal to 0, whereinthe secondary transform is performed based on a reduced transform,wherein the reduced transform is performed based on a transform matrixof which size is R×N, the N is equal to a number of modified transformcoefficients in the input target region to which the reduced transformis applied, the R is equal to a number of the transform coefficients inan output target region, and the R is smaller than the N, wherein theinformation about the transform coefficients for the target blockincludes information about a location of a last non-zero transformcoefficient, and wherein based on the case that the secondary transformindex is greater than 0, the last non-zero transform coefficient is oneof transform coefficients other than the transform coefficients for thetarget block in the range of the R+1^(th) to N^(th) transformcoefficients.